Esempio n. 1
0
        public Operation Delete(SlsDealer obj)
        {
            Operation objOperation = new Operation { Success = true, OperationId = obj.Id };
            _DealerRepository.Delete(obj);

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

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

            if (ModelState.IsValid)
            {
                if (dealer.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        int companyId = Convert.ToInt32(Session["companyId"]);
                        dealer.SecCompanyId = companyId;
                        dealer.CreatedBy = userId;
                        dealer.CreatedDate = DateTime.Now.Date;
                        objOperation = _dealerService.Save(dealer);
                    }
                    else { objOperation.OperationId = -1; }

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

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
Esempio n. 3
0
        public Operation Save(SlsDealer obj)
        {
            Operation objOperation = new Operation { Success = true };

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

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