Пример #1
0
        public ActionResult Edit(TimekeepingSynthesisViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var TimekeepingSynthesis = TimekeepingSynthesisRepository.GetTimekeepingSynthesisById(model.Id);
                    AutoMapper.Mapper.Map(model, TimekeepingSynthesis);
                    TimekeepingSynthesis.ModifiedUserId = WebSecurity.CurrentUserId;
                    TimekeepingSynthesis.ModifiedDate   = DateTime.Now;
                    TimekeepingSynthesisRepository.UpdateTimekeepingSynthesis(TimekeepingSynthesis);

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

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Пример #3
0
        public ActionResult Edit(int?Id)
        {
            var TimekeepingSynthesis = TimekeepingSynthesisRepository.GetTimekeepingSynthesisById(Id.Value);

            if (TimekeepingSynthesis != null && TimekeepingSynthesis.IsDeleted != true)
            {
                var model = new TimekeepingSynthesisViewModel();
                AutoMapper.Mapper.Map(TimekeepingSynthesis, 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 TimekeepingSynthesisViewModel();

            return(View(model));
        }