Пример #1
0
        public JsonResult ChangeBookingTime(STBookingGuest bvm)
        {
            var status = false;

            try
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("http://localhost:49455/Api/");
                string              JsonString = JsonConvert.SerializeObject(bvm);
                StringContent       content    = new StringContent(JsonString, Encoding.UTF8, "application/json");
                HttpResponseMessage response   = client.PutAsync("Booking/" + bvm.Id, content).Result;
                //Booking result = null;

                if (response.IsSuccessStatusCode)
                {
                    status = true;
                    BlobStockage.WriteLogs($"{DateTime.Now} : Changement sur le booking {bvm.Id} par {UserSession.CurrentUser.LastName} {UserSession.CurrentUser.FirstName}");
                    return(new JsonResult {
                        Data = new { status = status }
                    });
                }

                return(new JsonResult {
                    Data = new { status = status }
                });
            }
            catch
            {
                return(new JsonResult {
                    Data = new { status = status }
                });
            }
        }
Пример #2
0
        public ActionResult Index(int id)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:49455/Api/");
            HttpResponseMessage response = client.GetAsync("Room/" + id).Result;

            RoomTypeRoomVM results = new RoomTypeRoomVM();

            if (response.IsSuccessStatusCode)
            {
                results = JsonConvert.DeserializeObject <RoomTypeRoomVM>(response.Content.ReadAsStringAsync().Result);
            }

            List <IListBlobItem> v = BlobStockage.GetBlobPhoto("hotelmanagerphoto");

            foreach (var i in v)
            {
                results.BlobLinkPhoto.Add(i.Uri.AbsoluteUri.ToString());
            }

            return(View(results));
        }
Пример #3
0
        public JsonResult SaveBooking(STBookingGuest bvm)
        {
            var status = false;

            try
            {
                if (bvm.Id > 0)
                {
                    HttpClient client = new HttpClient();
                    client.BaseAddress = new Uri("http://localhost:49455/Api/");
                    string              JsonString = JsonConvert.SerializeObject(bvm);
                    StringContent       content    = new StringContent(JsonString, Encoding.UTF8, "application/json");
                    HttpResponseMessage response   = client.PutAsync("Booking/" + bvm.Id, content).Result;
                    //Booking result = null;

                    if (response.IsSuccessStatusCode)
                    {
                        status = true;
                        BlobStockage.WriteLogs($"{DateTime.Now} : Deleted Employee {bvm.Id}");
                        return(new JsonResult {
                            Data = new { status = status }
                        });
                    }

                    return(new JsonResult {
                        Data = new { status = status }
                    });
                }
                else
                {
                    try
                    {
                        HttpClient client = new HttpClient();
                        client.BaseAddress = new Uri("http://localhost:49455/Api/");
                        string              JsonString = JsonConvert.SerializeObject(bvm);
                        StringContent       content    = new StringContent(JsonString, Encoding.UTF8, "application/json");
                        HttpResponseMessage response   = client.PostAsync("Booking/", content).Result;
                        //Booking result = null;

                        if (response.IsSuccessStatusCode)
                        {
                            status = true;
                            //WriteLogs($"{DateTime.Now} : Deleted Employee {id}");
                            return(new JsonResult {
                                Data = new { status = status }
                            });
                        }

                        return(new JsonResult {
                            Data = new { status = status }
                        });
                    }
                    catch
                    {
                        return(new JsonResult {
                            Data = new { status = status }
                        });
                    }
                }
            }
            catch
            {
                return(new JsonResult {
                    Data = new { status = status }
                });
            }
        }