Exemplo n.º 1
0
        public Operation Delete(SlsOffice obj)
        {
            Operation objOperation = new Operation { Success = true, OperationId = obj.Id };
            _officeRepository.Delete(obj);

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

                objOperation.Success = false;
            }
            return objOperation;
        }
Exemplo n.º 2
0
        public Operation Save(SlsOffice obj)
        {
            Operation objOperation = new Operation { Success = true };

            long Id = _officeRepository.AddEntity(obj);
            objOperation.OperationId = Id;

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }
Exemplo n.º 3
0
        public ActionResult Save(SlsOffice office)
        {
            int userId = Convert.ToInt32(Session["userId"]);
            Operation objOperation = new Operation { Success = false };

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

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

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }