public async Task <IActionResult> Add() { var user = await GetCurrentUserAsync(); var siteId = user.SiteID; //Loads the dropdown data ViewBag.CategoryId = new SelectList(_repository.GetAllCategories(siteId), "CategoryId", "Name"); ViewBag.UOMId = new SelectList(_repository.GetAllUOMs(siteId), "UOMId", "Name"); ViewBag.LocationId = new SelectList(_repository.GetAllLocations(siteId), "LocationId", "Name"); Product model = new Product(); return(View(model)); }
public async Task <IActionResult> List() { //SuccessMsg is used to hide or display the data saved alert notification. @ViewBag.SuccessMsg = "hidden"; if (RouteData.Values.ContainsKey("Id")) { string key; key = RouteData.Values["Id"].ToString(); if (key == "success") { @ViewBag.SuccessMsg = ""; } } var user = await GetCurrentUserAsync(); var siteId = user.SiteID; var data = _repository.GetAllCategories(siteId); return(View(data)); }