public Operation Delete(SlsDiscountSetting obj) { Operation objOperation = new Operation { Success = true, OperationId = obj.Id }; _salesDiscountSettingRepository.Delete(obj); try { _unitOfWork.Commit(); } catch (Exception) { objOperation.Success = false; } return objOperation; }
public ActionResult Save(SlsDiscountSetting discountSetting) { int userId = Convert.ToInt32(Session["userId"]); Operation objOperation = new Operation { Success = false }; if (ModelState.IsValid) { if (discountSetting.Id == 0) { if ((bool)Session["Add"]) { discountSetting.Id = 0;//new value input discountSetting.CreatedBy = userId; discountSetting.CreatedDate = DateTime.Now.Date; objOperation = _salesDiscountSettingService.Save(discountSetting); } else { objOperation.OperationId = -1; } } else { if ((bool)Session["Edit"]) { discountSetting.ModifiedBy = userId; discountSetting.ModifiedDate = DateTime.Now.Date; objOperation = _salesDiscountSettingService.Update(discountSetting); } else { objOperation.OperationId = -2; } } } return Json(objOperation, JsonRequestBehavior.DenyGet); }
public Operation Save(SlsDiscountSetting obj) { Operation objOperation = new Operation { Success = true }; int Id = _salesDiscountSettingRepository.AddEntity(obj); objOperation.OperationId = Id; try { _unitOfWork.Commit(); } catch (Exception ex) { objOperation.Success = false; } return objOperation; }