public ActionResult DeleteConfirmed(int id) { if (!User.Identity.IsAuthenticated) { Response.Redirect("~/Login.aspx"); } if (!User.Identity.Name.Equals("Admin")) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } imovinskoosiguranje imovinskoosiguranje = db.imovinskoosiguranje.Find(id); db.imovinskoosiguranje.Remove(imovinskoosiguranje); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,OsiguranjeID,JMBG,DatumPocetka,DatumZavrsetka,Status,Izlozenos")] imovinskoosiguranje imovinskoosiguranje) { if (!User.Identity.IsAuthenticated) { Response.Redirect("~/Login.aspx"); } if (!User.Identity.Name.Equals("Admin")) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } if (ModelState.IsValid) { db.Entry(imovinskoosiguranje).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.JMBG = new SelectList(db.klijent, "JMBG", "Ime", imovinskoosiguranje.JMBG); ViewBag.OsiguranjeID = new SelectList(db.osiguranje, "ID", "JMBG", imovinskoosiguranje.OsiguranjeID); return(View(imovinskoosiguranje)); }
// GET: imovinskoosiguranje/Details/5 public ActionResult Details(int?id) { if (!User.Identity.IsAuthenticated) { Response.Redirect("~/Login.aspx"); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } imovinskoosiguranje imovinskoosiguranje = db.imovinskoosiguranje.Find(id); if (imovinskoosiguranje == null) { return(HttpNotFound()); } if (!User.Identity.Name.Equals("Admin")) { return(View("Details403", imovinskoosiguranje)); } return(View(imovinskoosiguranje)); }
// GET: imovinskoosiguranje/Edit/5 public ActionResult Edit(int?id) { if (!User.Identity.IsAuthenticated) { Response.Redirect("~/Login.aspx"); } if (!User.Identity.Name.Equals("Admin")) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } imovinskoosiguranje imovinskoosiguranje = db.imovinskoosiguranje.Find(id); if (imovinskoosiguranje == null) { return(HttpNotFound()); } ViewBag.JMBG = new SelectList(db.klijent, "JMBG", "Ime", imovinskoosiguranje.JMBG); ViewBag.OsiguranjeID = new SelectList(db.osiguranje, "ID", "JMBG", imovinskoosiguranje.OsiguranjeID); return(View(imovinskoosiguranje)); }