public Operation Delete(SlsDistrict obj)
        {
            Operation objOperation = new Operation { Success = true, OperationId = obj.Id };
            _districtRepository.Delete(obj);

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception)
            {

                objOperation.Success = false;
            }
            return objOperation;
        }
        public ActionResult Save(SlsDistrict district)
        {
            int userId = Convert.ToInt32(Session["userId"]);
            Operation objOperation = new Operation { Success = false };

            if (ModelState.IsValid)
            {
                if (district.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        SlsDistrict newDistrict = new SlsDistrict();
                        newDistrict.Id = 0;
                        newDistrict.Name = district.Name;
                        newDistrict.Code = district.Code;
                        newDistrict.Remarks = district.Remarks;
                        newDistrict.SlsOfficeId = district.SlsOfficeId;
                        newDistrict.CreatedBy = userId;
                        newDistrict.CreatedDate = DateTime.Now.Date;
                        objOperation = _districtService.Save(newDistrict);
                    }
                    else { objOperation.OperationId = -1; }

                }
                else
                {
                    if ((bool)Session["Edit"])
                    {
                        district.ModifiedBy = userId;
                        district.ModifiedDate = DateTime.Now.Date;
                        objOperation = _districtService.Update(district);
                    }
                    else { objOperation.OperationId = -2; }
                }
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
        public Operation Save(SlsDistrict obj)
        {
            Operation objOperation = new Operation { Success = true };

            int Id = _districtRepository.AddEntity(obj);
            objOperation.OperationId = Id;

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }