public JsonResult ClosePayBox(PayBox payBox) { return Json(new { result = _payBoxRepository.Close(payBox) }, JsonRequestBehavior.AllowGet); }
public void UpdatePayBox(int typeOfPayment) { try { PayBox pB = GetCurrentPayBox(); decimal? fullValue = GerValueWhenPaidWithMoney(typeOfPayment); var payBox = new PayBox { PayBoxID = pB.PayBoxID, UserID = GetCurrentUser((Session[name: "UserName"]).ToString()), Value = fullValue }; int result = payBox.PayBoxID == 0 ? _payBoxRepository.Creates(GetCurrentUser((Session[name: "UserName"]).ToString())) : _payBoxRepository.Update(payBox); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } }