public ActionResult Approve(int id) { var receive = _receiveService.GetReceiveById(id); if (receive == null) { return(RedirectToAction("Create")); } if (!_receiveService.HasReceiveDetail(receive.Id)) { ErrorNotification("Receive don't have any product. Please add some product into receive before approve!"); return(RedirectToAction("Edit", new { receive.Id })); } if (_receiveService.CheckQuantityInReceiveDetail(receive.Id)) { ErrorNotification("Product detail is invalid. Please check again!"); return(RedirectToAction("Edit", new { receive.Id })); } var currentUser = Session[Values.USER_SESSION] as UserModel; receive.ApprovedBy = currentUser.Id; receive.Status = true; _receiveService.Approved(receive); SuccessNotification("Approve receive successfully."); return(RedirectToAction("Edit", new { receive.Id })); }
public ActionResult Approve(int id) { var receive = _receiveService.GetReceiveById(id); if (receive == null) { return(RedirectToAction("Create")); } if (!_receiveService.HasReceiveDetail(receive.Id)) { ErrorNotification("Phiếu nhập chưa có chi tiết. Vui lòng thêm sản phẩm vào chi tiết phiếu nhập trước khi duyệt !"); return(RedirectToAction("Edit", new { receive.Id })); } if (_receiveService.CheckQuantityInReceiveDetail(receive.Id)) { ErrorNotification("Chi tiết sản phẩm không hợp lệ. Vui lòng kiểm tra lại!"); return(RedirectToAction("Edit", new { receive.Id })); } var currentUser = Session[Values.USER_SESSION] as UserModel; receive.ApprovedBy = currentUser.Id; receive.Status = true; _receiveService.Approved(receive); SuccessNotification("Duyệt phiếu nhập thành công."); return(RedirectToAction("Edit", new { receive.Id })); }