public async Task<ActionResult> EditProduct(AddEditProductViewModel model) { model.LoggedInUser = await storeService.GetCurrentUser(); model.FullNavList = CreateStoreControllerAdminNavList(); if (ModelState.IsValid == false) { return View(model); } storeService.EditProduct(model.Product); if (model.Product?.Listings.Count > 0) { return RedirectToAction("AdminListings"); } else { return RedirectToAction("AdminProducts"); } }
public async Task<ActionResult> EditProduct(int id) { AddEditProductViewModel model = new AddEditProductViewModel(); model.Product = storeService.GetProductByID(id); model.LoggedInUser = await storeService.GetCurrentUser(); model.FullNavList = CreateStoreControllerAdminNavList(); return View(model); }