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> 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.GetAllLocations(siteId); return(View(data)); }
public async Task <IActionResult> Edit() { if (RouteData.Values.ContainsKey("Id")) { var user = await GetCurrentUserAsync(); var siteId = user.SiteID; string key; key = RouteData.Values["Id"].ToString(); StockItem model = new StockItem(); model = _repository.GetStockItem(key, siteId); //Loads the dropdown data ViewBag.LocationId = new SelectList(_repository.GetAllLocations(siteId), "LocationId", "Name", model.LocationId); return(View(model)); } else { return(RedirectToAction("list")); } }