public static TradmarkEntity ToDto(TradmarkModel model) { return(new TradmarkEntity { TrdID = model.TrdID, TrdName = model.TrdName }); }
public ActionResult DeleteTradmark(TradmarkModel model) { if (Session["S_EmpID"] != null && Session["S_EmpFname"] != null) { var result = _tradRepository.DeleteTradmark(model.TrdID); return(RedirectToAction("ListTradmark")); } else { return(RedirectToAction("Login2", "Account")); } }
public ActionResult TradmarkCreate(TradmarkModel model) { if (Session["S_EmpID"] != null && Session["S_EmpFname"] != null) { if (ModelState.IsValid) { _tradRepository.InsertTradmark(Mapper.ToDto(model)); ViewBag.StatusMessage = "Success"; return(RedirectToAction("ListTradmark")); } ModelState.AddModelError("", "Please complete the following information !"); return(View()); } else { return(RedirectToAction("Login2", "Account")); } }
public ActionResult EditTradmark(TradmarkModel model) { if (Session["S_EmpID"] != null && Session["S_EmpFname"] != null) { if (ModelState.IsValid) { if (_tradRepository.UpdateTradmark(Mapper.ToDto(model)) == true) { return(RedirectToAction("ListTradmark")); } } return(View(model)); } else { return(RedirectToAction("Login2", "Account")); } }