public ActionResult Index() { string requestURL = "api/rooms";// Get all the rooms var response = _client.CallApi(requestURL); var suppliersRoomVm = new HotelRoomsViewModel(); if (response.IsSuccessStatusCode) { var suppliersRooms = JsonConvert.DeserializeObject <List <SuppliersRooms> >(response.Content.ReadAsStringAsync().Result); suppliersRoomVm.RoomsByRoomType = (from room in suppliersRooms group room by room.RoomType into supplierRoomGroup select new HotelRoomsModel { RoomTypes = supplierRoomGroup.Key, SuppliersRooms = supplierRoomGroup.ToList() }).ToList(); } return(View("Index", suppliersRoomVm)); }
public ActionResult TranslateCheck(ChequeRequestViewModel vm) { string requestURL = $"api/Translate/{vm.Name}/{vm.Amount}/"; var response = _client.CallApi(requestURL); if (response.IsSuccessStatusCode) { var checqueResult = JsonConvert.DeserializeObject <ChecqueResult>(response.Content.ReadAsStringAsync().Result); var checkResultvm = new ChecqueResultViewModel() { AmountInWords = checqueResult.AmountInWords, Name = checqueResult.Name }; return(View("CheckResult", checkResultvm)); } return(RedirectToAction("Index", vm)); }