public Operation Delete(SlsIncentive obj) { Operation objOperation = new Operation { Success = true, OperationId = obj.Id }; _IncentivePaymentRepository.Delete(obj); try { _UnitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public Operation Save(SlsIncentive obj) { Operation objOperation = new Operation { Success = true }; long Id = _IncentivePaymentRepository.AddEntity(obj); objOperation.OperationId = Id; try { _UnitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }
public ActionResult SavePayment(SlsIncentive obj) { int userId = Convert.ToInt32(Session["userId"]); Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { if (obj.Id == 0) { if ((bool)Session["Add"]) { obj.CreatedBy = userId; obj.CreatedDate = DateTime.Now.Date; obj.PaymentDate = DateTime.Now.Date; objOperation = _incentivePaymentService.Save(obj); } else { objOperation.OperationId = -1; } } else { if ((bool)Session["Edit"]) { obj.ModifiedBy = userId; obj.ModifiedDate = DateTime.Now.Date; obj.PaymentDate = DateTime.Now.Date; objOperation = _incentivePaymentService.Update(obj); } else { objOperation.OperationId = -2; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }