public ActionResult EditCharge(ScrollDetailDTO charge, bool asService = false) { if (this.Request.IsAjaxRequest() && this.ModelState.IsValid) { var result = this._bussinesEngage.EditKrtNaftanOrcSapod(charge); if (asService) { return(this.Json(result, JsonRequestBehavior.DenyGet)); } } Log.Debug($"EditCharge method isn't valid: {this.ModelErrors}."); return(this.RedirectToAction("Index", "Scroll", new { page = 1 })); }
/// <summary> /// Edit financial index in selected charge /// </summary> /// <param name="charge"></param> /// <returns></returns> public bool EditKrtNaftanOrcSapod(ScrollDetailDTO charge) { try { using (this._engage.Uow = new UnitOfWork()) { var conditions = new List <Action <krt_Naftan_orc_sapod> > { x => x.nds = charge.nds, x => x.summa = charge.summa, x => x.kol = charge.kol, x => x.textm = charge.textm, x => x.ErrorState = 2 }; this._engage.Uow.GetRepository <krt_Naftan_orc_sapod>() .Update( x => x.keykrt == charge.keykrt && x.keysbor == charge.keysbor, conditions); this._engage.Uow.GetRepository <krt_Naftan>().Update( x => x.KEYKRT == charge.keykrt, new List <Action <krt_Naftan> > { x => x.ErrorState = 2 }); this._engage.Uow.Save(); } } catch (Exception ex) { this._engage.Log.Debug($"Method EditKrtNaftanOrcSapod throws exception: {ex.Message}."); return(false); } return(true); }