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