示例#1
0
        public ActionResult Edit(TotalDiscountMoneyNTViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var TotalDiscountMoneyNT = TotalDiscountMoneyNTRepository.GetTotalDiscountMoneyNTById(model.Id);
                    AutoMapper.Mapper.Map(model, TotalDiscountMoneyNT);
                    TotalDiscountMoneyNT.ModifiedUserId = WebSecurity.CurrentUserId;
                    TotalDiscountMoneyNT.ModifiedDate   = DateTime.Now;
                    TotalDiscountMoneyNTRepository.UpdateTotalDiscountMoneyNT(TotalDiscountMoneyNT);

                    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(TotalDiscountMoneyNTViewModel model)
        {
            if (ModelState.IsValid)
            {
                var TotalDiscountMoneyNT = new TotalDiscountMoneyNT();
                AutoMapper.Mapper.Map(model, TotalDiscountMoneyNT);
                TotalDiscountMoneyNT.IsDeleted      = false;
                TotalDiscountMoneyNT.CreatedUserId  = WebSecurity.CurrentUserId;
                TotalDiscountMoneyNT.ModifiedUserId = WebSecurity.CurrentUserId;
                TotalDiscountMoneyNT.AssignedUserId = WebSecurity.CurrentUserId;
                TotalDiscountMoneyNT.CreatedDate    = DateTime.Now;
                TotalDiscountMoneyNT.ModifiedDate   = DateTime.Now;
                TotalDiscountMoneyNTRepository.InsertTotalDiscountMoneyNT(TotalDiscountMoneyNT);

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

            if (TotalDiscountMoneyNT != null && TotalDiscountMoneyNT.IsDeleted != true)
            {
                var model = new TotalDiscountMoneyNTViewModel();
                AutoMapper.Mapper.Map(TotalDiscountMoneyNT, model);
                model.DetailList = new List <vwProductInvoiceDetail>();
                model.DetailList = productInvoiceRepository.GetAllvwInvoiceDetails()
                                   .Where(x => x.IsArchive == true && x.BranchId == model.DrugStoreId &&
                                          x.Month == model.Month && x.Year == model.Year).ToList();

                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }
示例#4
0
        public ActionResult Edit(int?Id)
        {
            var TotalDiscountMoneyNT = TotalDiscountMoneyNTRepository.GetTotalDiscountMoneyNTById(Id.Value);

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

                if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && 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"));
        }
示例#5
0
        public ViewResult Create()
        {
            var model = new TotalDiscountMoneyNTViewModel();

            return(View(model));
        }