public static TypeproductEntity ToDto(TypeproductModel model) { return(new TypeproductEntity { TypeProductID = model.TypeProductID, TypeName = model.TypeName, }); }
public ActionResult DeleteType(TypeproductModel model) { if (Session["S_EmpID"] != null && Session["S_EmpFname"] != null) { var result = _typeRepository.DeleteTypeproduct(model.TypeProductID); return(RedirectToAction("ListType")); } else { return(RedirectToAction("Login2", "Account")); } }
public ActionResult EditType(TypeproductModel model) { if (Session["S_EmpID"] != null && Session["S_EmpFname"] != null) { if (ModelState.IsValid) { if (_typeRepository.UpdateTypeproduct(Mapper.ToDto(model)) == true) { return(RedirectToAction("ListType")); } } return(View(model)); } else { return(RedirectToAction("Login2", "Account")); } }
public ActionResult TypeCreate(TypeproductModel model) { if (Session["S_EmpID"] != null && Session["S_EmpFname"] != null) { if (ModelState.IsValid) { _typeRepository.InsertTypeproduct(Mapper.ToDto(model)); ViewBag.StatusMessage = "Success"; return(RedirectToAction("ListType")); } ModelState.AddModelError("", "Please complete the following information !"); return(View()); } else { return(RedirectToAction("Login2", "Account")); } }