Exemple #1
0
 public ActionResult Edit(ReceiveModel model)
 {
     try
     {
         var receive = _receiveService.GetReceiveById(model.Id);
         if (receive == null)
         {
             return(RedirectToAction("List"));
         }
         if (!ModelState.IsValid)
         {
             return(View(model));
         }
         var currentUser = Session[Values.USER_SESSION] as UserModel;
         model.UpdatedBy       = currentUser.Id;
         model.UpdatedDateTime = DateTime.Now;
         _receiveService.UpdateReceive(model);
         SuccessNotification("Update receive information successfully.");
         return(model.ContinueEditing ? RedirectToAction("Edit", new { id = model.Id }) : RedirectToAction("List"));
     }
     catch (Exception e)
     {
         ErrorNotification("Update receive information failed.");
         return(View(model));
     }
 }