Example #1
0
 public static TypeproductEntity ToDto(TypeproductModel model)
 {
     return(new TypeproductEntity
     {
         TypeProductID = model.TypeProductID,
         TypeName = model.TypeName,
     });
 }
Example #2
0
 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"));
     }
 }
Example #3
0
 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"));
     }
 }
Example #4
0
 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"));
     }
 }