public async Task <IActionResult> Add() { var user = await GetCurrentUserAsync(); var siteId = user.SiteID; //Loads the dropdown data ViewBag.ProductId = new SelectList(_repository.GetAllProducts(siteId), "ProductId", "ProductCode"); ViewBag.LocationId = new SelectList(_repository.GetAllLocations(siteId), "LocationId", "Name"); return(View()); }
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.GetAllProducts(siteId); return(View(data)); }