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