Пример #1
0
 public ActionResult Create(ReceiveModel model)
 {
     try
     {
         var currentUser = Session[Values.USER_SESSION] as UserModel;
         model.CreatedBy       = currentUser.Id;
         model.CreatedDateTime = DateTime.Now;
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         _receiveService.InsertReceive(model);
         SuccessNotification("Thêm mới phiếu nhập thành công");
         return(model.ContinueEditing ? RedirectToAction("Edit", new { id = model.Id }) : RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Thêm mới phiếu nhập thất bại");
         return(View(model));
     }
 }
Пример #2
0
 public ActionResult Create(ReceiveModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         if (_receiveService.IsReceiveCodeExisted(model.Code))
         {
             ErrorNotification("Add new receive failed. Receive code is existed.");
             return(View(model));
         }
         _receiveService.InsertReceive(model);
         SuccessNotification("Add new receive successfully.");
         return(model.ContinueEditing ? RedirectToAction("Edit", new { id = model.Id }) : RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Add new receive failed.");
         return(View(model));
     }
 }