public ActionResult Edit_Przelozony(int id, Zgloszenia zgloszenieToEdit) { if ((!User.Identity.IsAuthenticated && !User.IsInRole("Administrator")) || (User.Identity.IsAuthenticated && User.IsInRole("Pracownik"))) { return(RedirectToAction("Index", "Home")); } if (ModelState.IsValid) { _db_Zgloszenia.Entry(zgloszenieToEdit).State = System.Data.Entity.EntityState.Modified; _db_Zgloszenia.SaveChanges(); return(RedirectToAction("Zgloszenia_Przelozony")); } return(View(zgloszenieToEdit)); }
public ActionResult Delete(int id, Zgloszenie zgloszenie) { try { // TODO: Add delete logic here using (var db = new ZgloszeniaEntities()) { db.Entry(zgloszenie).State = System.Data.EntityState.Deleted; db.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }