fix Access issues
This commit is contained in:
@ -93,6 +93,7 @@ namespace WebApplication1.Controllers
|
|||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (news.image == null) { news.image = "_"; }
|
||||||
return View(news);
|
return View(news);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -144,6 +145,7 @@ namespace WebApplication1.Controllers
|
|||||||
if (!new[] { ".jpg", ".jpeg", ".png" }.Contains(fileExtension))
|
if (!new[] { ".jpg", ".jpeg", ".png" }.Contains(fileExtension))
|
||||||
{
|
{
|
||||||
ModelState.AddModelError("image", "Only JPG, JPEG, and PNG files are allowed.");
|
ModelState.AddModelError("image", "Only JPG, JPEG, and PNG files are allowed.");
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -190,8 +192,7 @@ namespace WebApplication1.Controllers
|
|||||||
{
|
{
|
||||||
if (Session["User"] != null)
|
if (Session["User"] != null)
|
||||||
{
|
{
|
||||||
if (Convert.ToInt32(Session["Userrole"]) == 1)
|
|
||||||
{
|
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||||
@ -207,11 +208,7 @@ namespace WebApplication1.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
|
return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return RedirectToAction("index", "home");
|
return RedirectToAction("index", "home");
|
||||||
@ -239,8 +236,6 @@ namespace WebApplication1.Controllers
|
|||||||
{
|
{
|
||||||
if (Session["User"] != null)
|
if (Session["User"] != null)
|
||||||
{
|
{
|
||||||
if (Convert.ToInt32(Session["Userrole"]) == 1)
|
|
||||||
{
|
|
||||||
if (id == null)
|
if (id == null)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||||
@ -256,11 +251,7 @@ namespace WebApplication1.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
|
return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.Unauthorized);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return RedirectToAction("index", "home");
|
return RedirectToAction("index", "home");
|
||||||
|
|||||||
BIN
Media/news/AnaSQwnOHg.jpg
Normal file
BIN
Media/news/AnaSQwnOHg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
@ -24,7 +24,7 @@
|
|||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd>
|
<dd>
|
||||||
<img src="@Url.Content(Model.image)" height="270" width="200" />
|
<img src="@Url.Content(Model.image)" alt="@Model.title" height="270" width="200" />
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt>
|
<dt>
|
||||||
|
|||||||
@ -40,13 +40,19 @@
|
|||||||
</dl>
|
</dl>
|
||||||
<div class="col-md-offset-2 col-md-10">
|
<div class="col-md-offset-2 col-md-10">
|
||||||
@Html.ActionLink("edit account details", "Edit", null, new { @class = "btn btn-outline-dark" })
|
@Html.ActionLink("edit account details", "Edit", null, new { @class = "btn btn-outline-dark" })
|
||||||
|
|
||||||
@Html.ActionLink("Logout", "LogOut", null, new { @class = "btn btn-outline-dark" })
|
@Html.ActionLink("Logout", "LogOut", null, new { @class = "btn btn-outline-dark" })
|
||||||
|
|
||||||
|
@if (@ViewBag.role == "admin")
|
||||||
|
{
|
||||||
|
@Html.ActionLink("Manage users", "allusers", null, new { @class = "btn btn-outline-dark" })
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div class="col-md-offset-2 col-md-10">
|
<div class="col-md-offset-2 col-md-10">
|
||||||
@Html.ActionLink("Delete Account", "Delete", null, new { @class = "btn btn-outline-dark" })
|
@Html.ActionLink("Delete Account", "Delete", null, new { @class = "btn btn-outline-dark" })
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
@Html.DisplayFor(modelItem => item.displayname)
|
@Html.DisplayFor(modelItem => item.displayname)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
|
@Html.ActionLink("Edit", "Edituser", new { id=item.ID }) |
|
||||||
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
|
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
|
||||||
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
|
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user