예제 #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 bool Put(int id, STBookingGuest stb)
        {
            if (stb == null || id == 0)
            {
                return(false);
            }

            return(UnitOfWork.Instance.STBookingGuestRepository.Update(stb.ToGlobal()));
        }
예제 #3
0
 public int Post(STBookingGuest stb)
 {
     if (stb == null)
     {
         return(0);
     }
     stb.Userid = 1;
     return(UnitOfWork.Instance.STBookingGuestRepository.Insert(stb.ToGlobal()));
 }
예제 #4
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 }
                });
            }
        }