Exemple #1
0
        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));
        }
Exemple #2
0
        public ActionResult Makes()
        {
            var repo = MakeRepositoryFactory.GetRepository();
            var vm   = new MakeAddViewModel();

            vm.MakeUserTable = repo.GetMakeUserTable();

            return(View(vm));
        }
Exemple #3
0
 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));
     }
 }
Exemple #4
0
        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));
            }
        }
Exemple #5
0
 public ActionResult AddMake(MakeAddViewModel model)
 {
     return(View(model));
 }