Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 3
0
 public void Update(ReligionVM religionVM)
 {
     this.Name       = religionVM.Name;
     this.UpdateDate = DateTime.Now.ToLocalTime();
 }
Ejemplo n.º 4
0
 public Religion(ReligionVM religionVM)
 {
     this.Name       = religionVM.Name;
     this.CreateDate = DateTime.Now.ToLocalTime();
 }
Ejemplo n.º 5
0
 public Religion(ReligionVM religionVM)
 {
     this.Name       = religionVM.Name;
     this.CreateDate = DateTimeOffset.Now.LocalDateTime;
 }
Ejemplo n.º 6
0
 public void Update(ReligionVM religionVM)
 {
     this.Name       = religionVM.Name;
     this.UpdateDate = DateTimeOffset.Now.LocalDateTime;
 }