public ActionResult ShowData(InstitutionInfo institutionInfo) { if (string.IsNullOrWhiteSpace(institutionInfo.TaxId)) { return(RedirectToAction("Index", "VatReturnForm")); } else { var data = _context.InstitutionInfos.SingleOrDefault(c => c.TaxId == institutionInfo.TaxId); if (data == null) { return(HttpNotFound()); } else { var taxData = _context.ValueAddedTaxs.Where(c => c.InstitutionInfoId == data.Id).ToList(); var viewData = new ShowDataViewModel { InstitutionInfo = data, ValueAddedTaxs = taxData }; return(View(viewData)); } } }
public async Task <IActionResult> Index() { var apiClient = await _sensorHttpClient.GetClient(); using (apiClient) { try { var response = await apiClient.GetAsync("api/SensorDatas"); if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().Result; //json serializer settings JsonSerializerSettings settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Culture = CultureInfo.CurrentCulture, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateParseHandling = DateParseHandling.DateTime, Error = delegate(object sender, ErrorEventArgs args) { args.ErrorContext.Handled = true; } }; var measurements = JsonConvert.DeserializeObject <List <Data> >(result, settings); var viewModel = new ShowDataViewModel(measurements); return(View(viewModel)); } throw new Exception($"A problem happened while calling the API: {response.ReasonPhrase}"); } catch (HttpRequestException e) { throw new HttpRequestException(e.Message); } catch (ArgumentNullException n) { throw new ArgumentNullException(n.Message); } } }
public ListViewAdapter(Activity c, List <PersonalInfo> dta, ShowDataViewModel vm) : base() { context = c; data = dta; ViewModel = vm; }