Ejemplo n.º 1
0
        public ActionResult Edit(HolidaysViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var Holidays = HolidaysRepository.GetHolidaysById(model.Id);
                    AutoMapper.Mapper.Map(model, Holidays);
                    Holidays.ModifiedUserId = WebSecurity.CurrentUserId;
                    Holidays.ModifiedDate   = DateTime.Now;
                    HolidaysRepository.UpdateHolidays(Holidays);

                    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");
        }