Ejemplo n.º 1
0
        public ActionResult Cuisine(CuisineModel cuisine)
        {
            if (ModelState.IsValid)
            {
                UserModel    user      = (UserModel)Session["User"];
                CuisineModel dbCuisine = CuisineManager.GetVendorCuisine(VendorManager.GetOwnerVendor(user.UserID).VendorID);

                if (!string.IsNullOrEmpty(dbCuisine.CuisineName))
                {
                    cuisine.CuisineID = dbCuisine.CuisineID;
                    cuisine.MenuID    = dbCuisine.MenuID;
                    cuisine.VendorID  = dbCuisine.VendorID;
                    CuisineManager.Update(cuisine);
                    TempData["Message"] = "Cuisine was updated";
                }
                else
                {
                    cuisine.MenuID   = 1;
                    cuisine.VendorID = VendorManager.GetOwnerVendor(user.UserID).VendorID;
                    CuisineManager.Insert(cuisine);
                    TempData["Message"] = "Cuisine was added";
                }

                return(RedirectToAction("VendorMenus", "Vendor"));
            }

            return(View(cuisine));
        }
Ejemplo n.º 2
0
        public ActionResult GetEmployees()
        {
            if (Authenticate.IsVendorOwner())
            {
                UserModel userModel = (UserModel)Session["User"];

                VendorModel vendor = VendorManager.GetOwnerVendor(userModel.UserID);
                List <VendorEmployeeModel> employees = VendorEmployeeManager.GetVendorEmployees(vendor.VendorID);

                List <EmployeeVendorViewModel> evvm = new List <EmployeeVendorViewModel>();

                foreach (var item in employees)
                {
                    evvm.Add(new EmployeeVendorViewModel
                    {
                        User     = UserManager.GetUser(item.UserID),
                        Employee = item,
                        Vendor   = vendor
                    });
                }

                return(View(evvm));
            }
            return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url.AbsolutePath }));
        }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            UserModel userModel = (UserModel)Session["User"];

            if (VendorManager.GetOwnerVendor(userModel.UserID).Confirmed == false)
            {
                TempData["Error"] = "Your truck has yet to be confirmed by an administrator!";
            }

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult AddEmployee(string UserList, VendorEmployeeModel vm)
        {
            UserModel userModel = (UserModel)Session["User"];

            vm.VendorID = VendorManager.GetOwnerVendor(userModel.UserID).VendorID;
            vm.UserID   = int.Parse(UserList);
            VendorEmployeeManager.Insert(vm);

            TempData["Message"] = "Employee has been hired";
            return(RedirectToAction("GetEmployees", "Vendor"));
        }
Ejemplo n.º 5
0
        public ActionResult CreateMenu()
        {
            UserModel userModel = (UserModel)Session["User"];
            MenuModel menuModel = new MenuModel()
            {
                VendorID = VendorManager.GetOwnerVendor(userModel.UserID).VendorID,
                IsActive = false
            };

            menuModel = MenuManager.Insert(menuModel);
            return(RedirectToAction("EditMenu", "Vendor", new { id = menuModel.MenuID }));
        }
Ejemplo n.º 6
0
        public ActionResult Cuisine()
        {
            UserModel    user    = (UserModel)Session["User"];
            CuisineModel cuisine = CuisineManager.GetVendorCuisine(VendorManager.GetOwnerVendor(user.UserID).VendorID);

            if (cuisine != null)
            {
                return(View(cuisine));
            }
            else
            {
                return(View(new CuisineModel()));
            }
        }
Ejemplo n.º 7
0
        public ActionResult VendorMenus()
        {
            if (Authenticate.IsVendorOwner())
            {
                UserModel userModel = (UserModel)Session["User"];

                MenusCuisineViewModel mcvm = new MenusCuisineViewModel()
                {
                    Menus   = MenuManager.GetVendorMenus(VendorManager.GetOwnerVendor(userModel.UserID).VendorID),
                    Cuisine = CuisineManager.GetVendorCuisine(VendorManager.GetOwnerVendor(userModel.UserID).VendorID)
                };
                return(View(mcvm));
            }
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 8
0
        public ActionResult AddEmployee()
        {
            List <UserModel>      users           = UserManager.GetUsers();
            List <SelectListItem> selectListItems = new List <SelectListItem>();

            foreach (var item in users)
            {
                selectListItems.Add(new SelectListItem {
                    Text = $"{item.FirstName} {item.LastName}", Value = item.UserID.ToString()
                });
            }
            ViewBag.UserList = selectListItems;
            UserModel userModel = (UserModel)Session["User"];

            ViewBag.Vendor = (VendorManager.GetOwnerVendor(userModel.UserID)).VendorID;
            return(View());
        }