public ActionResult Add() { WorkSubtypeView workSubtypeView = new WorkSubtypeView(); workSubtypeView.BindDDLs(workSubtypeView, db); return(View(workSubtypeView)); }
public ActionResult Edit(int?workSubtypePK) { if (workSubtypePK != null) { IWorkSubtypesRepository workSubtypesRepository = new WorkSubtypesRepository(db); WorkSubtype workSubtype = workSubtypesRepository.GetWorkSubtypeByPK((int)workSubtypePK); WorkSubtypeView workSubtypeView = new WorkSubtypeView(); workSubtypeView.ConvertFrom(workSubtype, workSubtypeView); workSubtypeView.BindDDLs(workSubtypeView, db); return(View(workSubtypeView)); } else { return(RedirectToAction("Index", "WorkSubtype")); } }
public ActionResult Edit(WorkSubtypeView workSubtypeView, FormCollection form) { if (ModelState.IsValid) { IWorkSubtypesRepository workSubtypesRepository = new WorkSubtypesRepository(db); WorkSubtype workSubtype = workSubtypesRepository.GetWorkSubtypeByPK((int)workSubtypeView.WorkSubtypePK); workSubtypeView.ConvertTo(workSubtypeView, workSubtype); workSubtypesRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("UPDATE", workSubtype.WorkSubtypePK); return(RedirectToAction("Index", "WorkSubtype")); } else { workSubtypeView.BindDDLs(workSubtypeView, db); return(View(workSubtypeView)); } }