public ActionResult EditCoin(int id) { try { CoinRequest.FindCoinById request = new CoinRequest.FindCoinById { Id = id }; HttpResponseMessage result = HttpService.PostAsync("api/coin/GetCoinById", request).Result; if (result.IsSuccessStatusCode) { var response = result.Content.ReadAsAsync <ParticularCoin>().Result; if (response.ErrorCode == 0 && string.IsNullOrEmpty(response.Message)) { return(View(new CoinViewModel.ParticularCoinModel { Id = response.Coin.Id, Caption = response.Coin.Caption, Count = response.Coin.Count, IsAllowed = response.Coin.IsAllowed })); } } } catch { return(View()); } return(View()); }
public ParticularCoin GetCoinById(CoinRequest.FindCoinById request) { try { return(new ParticularCoin { Coin = _coinService.GetCoinById(request.Id) }); } catch { return(null); } }