public ActionResult DeleteConfirmed(int id) { CourierMovement move = db.CourierMovements.Find(id); db.CourierMovements.Remove(move); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Deleted Movement Type."; return(RedirectToAction("Index")); }
public ActionResult Edit(MovementTypeVM a) { CourierMovement d = new CourierMovement(); d.MovementID = a.MovementTypeID; d.MovementType = a.MovementTypeName; db.Entry(d).State = EntityState.Modified; db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Updated Movement Type."; return(RedirectToAction("Index")); }
public ActionResult Create(MovementTypeVM c) { CourierMovement obj = new CourierMovement(); int max = (from a in db.CourierMovements orderby a.MovementID descending select a.MovementID).FirstOrDefault(); if (max == null) { obj.MovementID = 1; obj.MovementType = c.MovementTypeName; } else { obj.MovementID = max + 1; obj.MovementType = c.MovementTypeName; } db.CourierMovements.Add(obj); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully added Movement Type."; return(RedirectToAction("Index")); }