Ejemplo n.º 1
0
        public ActionResult Edit(CarLineViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var CarLine = CarLineService.Get(model.Id);
                    AutoMapper.Mapper.Map(model, CarLine);
                    SetModifier(CarLine, true);
                    CarLineService.Update(CarLine);

                    TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess;
                    if (Request["IsPopup"] != null && Request["IsPopup"].ToString().ToLower().Equals("true"))
                    {
                        return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                    }
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }

            return(View(model));

            //if (Request.UrlReferrer != null)
            //    return Redirect(Request.UrlReferrer.AbsoluteUri);
            //return RedirectToAction("Index");
        }
Ejemplo n.º 2
0
 public ActionResult Create(CarLineViewModel model)
 {
     if (ModelState.IsValid)
     {
         var CarLine = new CarLine();
         AutoMapper.Mapper.Map(model, CarLine);
         SetModifier(CarLine);
         CarLineService.Create(CarLine);
         TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
         if (Request["IsPopup"] != null && Request["IsPopup"].ToString().ToLower().Equals("true"))
         {
             return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
         }
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Ejemplo n.º 3
0
        public ActionResult Edit(int?Id)
        {
            var CarLine = CarLineService.Get(Id.Value);

            if (CarLine != null && CarLine.IsDeleted != true)
            {
                var model = new CarLineViewModel();
                AutoMapper.Mapper.Map(CarLine, 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"));
        }
Ejemplo n.º 4
0
        public ViewResult Create()
        {
            var model = new CarLineViewModel();

            return(View(model));
        }