Example #1
0
        public Operation Delete(SlsArea objSlsArea)
        {
            Operation objOperation = new Operation { Success = true, OperationId = objSlsArea.Id };
            _areaRepository.Delete(objSlsArea);

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

                objOperation.Success = false;
            }
            return objOperation;
        }
Example #2
0
        public Operation Save(SlsArea objSlsArea)
        {
            Operation objOperation = new Operation { Success = true };

            long Id = _areaRepository.AddEntity(objSlsArea);
            objOperation.OperationId = Id;

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }
        public ActionResult Save(SlsArea slsThana)
        {
            int userId = Convert.ToInt32(Session["userId"]);
            Operation objOperation = new Operation { Success = false };

            if (ModelState.IsValid)
            {
                if (slsThana.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        slsThana.CreatedBy = userId;
                        slsThana.CreatedDate = DateTime.Now.Date;
                        objOperation = _areaService.Save(slsThana);
                    }
                    else { objOperation.OperationId = -1; }

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

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }