public JsonResult LoadReligion() { string token = _configuration.GetValue <string>("Jwt"); ReligionVM religionVM = null; var client = new HttpClient { BaseAddress = new Uri("https://localhost:44372/api/") }; client.DefaultRequestHeaders.Add("Authorization", _configuration.GetValue <string>("Jwt")); var responseTask = client.GetAsync("Religions"); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { } else { // try to find something } return(Json(result)); }
public JsonResult GetById(int id) { ReligionVM religionVM = null; var client = new HttpClient { BaseAddress = new Uri("http://localhost:12280/api/") }; var responseTask = client.GetAsync("Religions/" + id); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <ReligionVM>(); readTask.Wait(); religionVM = readTask.Result; } else { // try to find something } return(Json(religionVM, JsonRequestBehavior.AllowGet)); }
public void Update(ReligionVM religionVM) { this.Name = religionVM.Name; this.UpdateDate = DateTime.Now.ToLocalTime(); }
public Religion(ReligionVM religionVM) { this.Name = religionVM.Name; this.CreateDate = DateTime.Now.ToLocalTime(); }
public Religion(ReligionVM religionVM) { this.Name = religionVM.Name; this.CreateDate = DateTimeOffset.Now.LocalDateTime; }
public void Update(ReligionVM religionVM) { this.Name = religionVM.Name; this.UpdateDate = DateTimeOffset.Now.LocalDateTime; }