Exemple #1
0
        public ActionResult LossReason_Create([DataSourceRequest] DataSourceRequest request, LossReasonModel lossReason)
        {
            if (lossReason != null && ModelState.IsValid)
            {
                _lossReasonService.AddLossReason(BindLossReason(lossReason));
            }

            return Json(new[] { lossReason }.ToDataSourceResult(request, ModelState));
        }
Exemple #2
0
 private LossReason BindLossReason(LossReasonModel model)
 {
     if (model == null) return null;
     var lossReason = new LossReason()
     {
         LossReasonId = model.LossReasonId,
         LossReasonAm = model.LossReasonAm,
         LossReasonEg = model.LossReasonEg,
         LossReasonCodeAm = model.LossReasonCodeAm,
         LossReasonCodeEg = model.LossReasonCodeEg,
         Description = model.Description
     };
     return lossReason;
 }
Exemple #3
0
        public ActionResult LossReason_Update([DataSourceRequest] DataSourceRequest request, LossReasonModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                var origin = _lossReasonService.FindById(model.LossReasonId);
                origin.LossReasonEg = model.LossReasonEg;
                origin.LossReasonAm = model.LossReasonAm;
                origin.LossReasonCodeEg = model.LossReasonCodeEg;
                origin.LossReasonCodeAm = model.LossReasonCodeAm;
                origin.Description = model.Description;

                _lossReasonService.EditLossReason(origin);
            }
            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }