public async Task <IActionResult> EditShop(int id, [Bind("Email,StreetAddress,City,State,ZipCode,Name,Longitude,Latitude")] ShopModel shop) { string route = $"api/Shop/EditShopDetails/{id}"; UriBuilder endPoint = new UriBuilder(Api); endPoint.Path = route; try { var edited = (await MvcHttpClient <ShopEntity, ShopModel> .PutAsync(endPoint.Uri, shop)).Value; ShopModel editedModel = new ShopModel { Email = edited.Email, StreetAddress = edited.StreetAddress, City = edited.City, State = edited.State, ZipCode = edited.ZipCode, Name = edited.Name, Latitude = edited.Latitude, Longitude = edited.Longitude }; return(RedirectToAction("Shop", id)); } catch (Exception ex) { return(BadRequest(ex)); } }
public async Task <IActionResult> EditShop(int id) { string route = $"api/Shop/{id}"; UriBuilder endPoint = new UriBuilder(Api); endPoint.Path = route; ShopModel shopModel = (await MvcHttpClient <ShopModel, dynamic> .GetAsync(endPoint.Uri)).Value; return(View(shopModel)); }
private async Task <ActionResult <ItemModel> > GetProductInformation(int id) { string route = $"api/Product/GetItem/{id}"; var endPoint = new UriBuilder(Api); endPoint.Path = route; try { ItemModel item = (await MvcHttpClient <ItemModel, dynamic> .GetAsync(endPoint.Uri)).Value; return(item); } catch (Exception ex) { return(new ItemModel()); } }
//useless for now public async Task <IActionResult> Index(int id) { string route = $"api/Shop/{id}"; UriBuilder endPoint = new UriBuilder(Api); endPoint.Path = route; ShopModel shopModel = (await MvcHttpClient <ShopModel, dynamic> .GetAsync(endPoint.Uri)).Value; if (shopModel != null) { return(View(shopModel)); } else { return(NotFound()); } }
public async Task <IActionResult> Product(int id) { string route = $"api/Product/GetItem/{id}"; var endPoint = new UriBuilder(Api); endPoint.Path = route; ItemModel item = (await MvcHttpClient <ItemModel, dynamic> .GetAsync(endPoint.Uri)).Value; if (item != null) { return(View(item)); } else { return(NotFound()); } }