Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        // 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));
        }
Esempio n. 4
0
        // 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));
        }