Example #1
0
        public ActionResult Edit(ContractLeaseViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var ContractLease = ContractLeaseRepository.GetContractLeaseById(model.Id);
                    AutoMapper.Mapper.Map(model, ContractLease);
                    ContractLease.ModifiedUserId = WebSecurity.CurrentUserId;
                    ContractLease.ModifiedDate   = DateTime.Now;
                    ContractLeaseRepository.UpdateContractLease(ContractLease);

                    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");
        }
Example #2
0
        public ActionResult Create(ContractLeaseViewModel model)
        {
            if (ModelState.IsValid)
            {
                var ContractLease = new ContractLease();
                AutoMapper.Mapper.Map(model, ContractLease);
                ContractLease.IsDeleted      = false;
                ContractLease.CreatedUserId  = WebSecurity.CurrentUserId;
                ContractLease.ModifiedUserId = WebSecurity.CurrentUserId;
                ContractLease.AssignedUserId = WebSecurity.CurrentUserId;
                ContractLease.CreatedDate    = DateTime.Now;
                ContractLease.ModifiedDate   = DateTime.Now;
                ContractLeaseRepository.InsertContractLease(ContractLease);

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Example #3
0
        public ActionResult Detail(int?Id)
        {
            var ContractLease = ContractLeaseRepository.GetContractLeaseById(Id.Value);

            if (ContractLease != null && ContractLease.IsDeleted != true)
            {
                var model = new ContractLeaseViewModel();
                AutoMapper.Mapper.Map(ContractLease, 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"));
        }
Example #4
0
        public ViewResult Create()
        {
            var model = new ContractLeaseViewModel();

            return(View(model));
        }