public ActionResult Makes() { var model1 = new MakeAddViewModel(); var model2 = new MakeRepositoryADO().GetAll(); if (User.Identity.IsAuthenticated) { var user = User.Identity; ViewBag.Name = user.Name; ViewBag.displayMenu = "No"; if (IsSalesUser()) { ViewBag.displayMenu = "Yes"; } return(View(model2)); } else { ViewBag.Name = "Log in to view page"; } model1.Makes = model2; return(View(model1)); }
public ActionResult Makes() { var repo = MakeRepositoryFactory.GetRepository(); var vm = new MakeAddViewModel(); vm.MakeUserTable = repo.GetMakeUserTable(); return(View(vm)); }
public ActionResult Makes(MakeAddViewModel model) { if (ModelState.IsValid) { var repo = new MakeRepositoryADO(); try { repo.Insert(model.Make); return(RedirectToAction("Makes")); } catch (Exception ex) { throw ex; } } else { return(View(model)); } }
public ActionResult Makes(MakeAddViewModel vm) { var repo = MakeRepositoryFactory.GetRepository(); if (ModelState.IsValid) { var newMake = new Make(); newMake.UserId = User.Identity.GetUserId(); newMake.Name = vm.NewMakeName; repo.Insert(newMake); return(RedirectToAction("Makes")); } else { repo = MakeRepositoryFactory.GetRepository(); vm.MakeUserTable = repo.GetMakeUserTable(); return(View(vm)); } }
public ActionResult AddMake(MakeAddViewModel model) { return(View(model)); }