Ejemplo n.º 1
0
        public IHttpActionResult PutDot(DotariClass dotare)
        {
            var update_results = hotel.spCRUDDotari(dotare.ID, dotare.Nume, dotare.Pret, "Update").ToList();

            hotel.SaveChanges();
            return(Ok(update_results));
        }
        public ActionResult Edit(DotariClass dotare)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("https://localhost:44322/api/DotariCRUD");

            var update_record = hc.PutAsJsonAsync <DotariClass>("DotariCRUD", dotare);

            update_record.Wait();

            var save_data = update_record.Result;

            if (save_data.IsSuccessStatusCode)
            {
                return(RedirectToAction("Dotari"));
            }

            return(View(dotare));
        }
        public ActionResult Edit(int id)
        {
            DotariClass dotare = null;
            HttpClient  hc     = new HttpClient();

            hc.BaseAddress = new Uri("https://localhost:44322/api/DotariCRUD");

            var consume_api = hc.GetAsync("DotariCRUD?id=" + id.ToString());

            consume_api.Wait();

            var read_data = consume_api.Result;

            if (read_data.IsSuccessStatusCode)
            {
                var display_details = read_data.Content.ReadAsAsync <DotariClass>();
                display_details.Wait();
                dotare = display_details.Result;
            }

            return(View(dotare));
        }