示例#1
0
        public ActionResult Edit(ContractSellViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var ContractSell = ContractSellRepository.GetContractSellById(model.Id);
                    AutoMapper.Mapper.Map(model, ContractSell);
                    ContractSell.ModifiedUserId = WebSecurity.CurrentUserId;
                    ContractSell.ModifiedDate   = DateTime.Now;
                    ContractSellRepository.UpdateContractSell(ContractSell);

                    TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess;
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }

            return(View(model));

            //if (Request.UrlReferrer != null)
            //    return Redirect(Request.UrlReferrer.AbsoluteUri);
            //return RedirectToAction("Index");
        }
示例#2
0
        public ActionResult Create(ContractSellViewModel model)
        {
            if (ModelState.IsValid)
            {
                var ContractSell = new ContractSell();
                AutoMapper.Mapper.Map(model, ContractSell);
                ContractSell.IsDeleted      = false;
                ContractSell.CreatedUserId  = WebSecurity.CurrentUserId;
                ContractSell.ModifiedUserId = WebSecurity.CurrentUserId;
                ContractSell.AssignedUserId = WebSecurity.CurrentUserId;
                ContractSell.CreatedDate    = DateTime.Now;
                ContractSell.ModifiedDate   = DateTime.Now;
                ContractSellRepository.InsertContractSell(ContractSell);

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
示例#3
0
        public ActionResult Edit(int?Id)
        {
            var ContractSell = ContractSellRepository.GetContractSellById(Id.Value);

            if (ContractSell != null && ContractSell.IsDeleted != true)
            {
                var model = new ContractSellViewModel();
                AutoMapper.Mapper.Map(ContractSell, model);

                if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                {
                    TempData["FailedMessage"] = "NotOwner";
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }
示例#4
0
        public ViewResult Create()
        {
            var model = new ContractSellViewModel();

            return(View(model));
        }