public ActionResult Delete(int id, DeleteWorkType workType) { WorkTypeRepository repo = new WorkTypeRepository(); WorkType newWorkType = new WorkType(id, workType.Name, 0); repo.Delete(newWorkType); return(RedirectToAction("Index")); }
public ActionResult Delete(int?id) { if (id == null) { return(RedirectToAction("Index")); } WorkTypeRepository repo = new WorkTypeRepository(); WorkType workType = repo.GetById(id.Value); if (workType == null) { return(RedirectToAction("Index")); } DeleteWorkType model = new DeleteWorkType(); model.Id = workType.Id; model.Name = workType.Name; return(View("Delete", model)); }