Пример #1
0
        public ActionResult Edit(ThuNhapChiuThueViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var ThuNhapChiuThue = ThuNhapChiuThueRepository.GetThuNhapChiuThueById(model.Id);
                    AutoMapper.Mapper.Map(model, ThuNhapChiuThue);
                    ThuNhapChiuThue.ModifiedUserId = WebSecurity.CurrentUserId;
                    ThuNhapChiuThue.ModifiedDate   = DateTime.Now;
                    ThuNhapChiuThueRepository.UpdateThuNhapChiuThue(ThuNhapChiuThue);

                    TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess;
                    return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                }

                return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
            }

            return(View(model));

            //if (Request.UrlReferrer != null)
            //    return Redirect(Request.UrlReferrer.AbsoluteUri);
            //return RedirectToAction("Index");
        }
Пример #2
0
        public ActionResult Create(ThuNhapChiuThueViewModel model)
        {
            if (ModelState.IsValid)
            {
                var ThuNhapChiuThue = new ThuNhapChiuThue();
                AutoMapper.Mapper.Map(model, ThuNhapChiuThue);
                ThuNhapChiuThue.IsDeleted      = false;
                ThuNhapChiuThue.CreatedUserId  = WebSecurity.CurrentUserId;
                ThuNhapChiuThue.ModifiedUserId = WebSecurity.CurrentUserId;
                ThuNhapChiuThue.AssignedUserId = WebSecurity.CurrentUserId;
                ThuNhapChiuThue.CreatedDate    = DateTime.Now;
                ThuNhapChiuThue.ModifiedDate   = DateTime.Now;
                ThuNhapChiuThueRepository.InsertThuNhapChiuThue(ThuNhapChiuThue);

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
            }
            return(View(model));
        }
Пример #3
0
        public ActionResult Edit(int?Id)
        {
            var ThuNhapChiuThue = ThuNhapChiuThueRepository.GetThuNhapChiuThueById(Id.Value);

            if (ThuNhapChiuThue != null && ThuNhapChiuThue.IsDeleted != true)
            {
                var model = new ThuNhapChiuThueViewModel();
                AutoMapper.Mapper.Map(ThuNhapChiuThue, 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"));
        }
Пример #4
0
        public ViewResult Create()
        {
            var model = new ThuNhapChiuThueViewModel();

            return(View(model));
        }