public ActionResult AddItemToCurrentBook(string siteID, string sitePriceID, string siteItemID, string price, string durasi, string totalprice, string startDate, string endDate, string prevSite)
        {
            AddBookOutputModel OutPutData = new AddBookOutputModel();

            if (HttpContext.Session.GetString(SessionKeyID) != null && HttpContext.Session.GetString(SessionKeyID) != "")
            {
                AddItemToCurrentBookListInputModel bookData = new AddItemToCurrentBookListInputModel();
                bookData.BookID = Guid.Parse(HttpContext.Session.GetString(SessionKeyBookID));
                bookData.BookDetailIDForDeleted = Guid.Parse(prevSite);
                bookData.Data = new List <AddItemToCurrentBookInputModel>();

                AddItemToCurrentBookInputModel Data = new AddItemToCurrentBookInputModel();
                Data.SitePriceID  = Guid.Parse(sitePriceID);
                Data.SiteID       = Guid.Parse(siteID);
                Data.SiteItemID   = Guid.Parse(siteItemID);
                Data.UserID       = Guid.Parse(HttpContext.Session.GetString(SessionKeyID));
                Data.StartDate    = DateTime.Parse(startDate);
                Data.EndDate      = DateTime.Parse(endDate);
                Data.Qty          = int.Parse(durasi);
                Data.Price        = double.Parse(price);
                Data.TotalPerItem = double.Parse(totalprice);
                bookData.Data.Add(Data);

                JsonConvert.SerializeObject(bookData);
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(BaseAPI + "Site/");
                    //HTTP POST
                    var postTask = client.PostAsJsonAsync <AddItemToCurrentBookListInputModel>("AddItemToCurrentBook", bookData);
                    postTask.Wait();

                    var result = postTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index", "Booking"));
                    }
                    else
                    {
                        TempData["CustomError"] = "Fail to add data. Please contact administrator.";
                    }
                }
                return(Json(OutPutData));
            }
            else
            {
                TempData["CustomError"] = "Mohon masuk sebelum mengakses halaman ini.";
                return(RedirectToAction("Index", "Home"));
            }
        }
        public ActionResult AddItemToCurrentBook(string siteID, string sitePriceID, string siteItemID, string price, string durasi, string totalprice, string startDate, string endDate, string prevSite)
        {
            AddBookOutputModel OutPutData = new AddBookOutputModel();

            if (HttpContext.Session.GetString(SessionKeyID) != null && HttpContext.Session.GetString(SessionKeyID) != "")
            {
                AddItemToCurrentBookListInputModel bookData = new AddItemToCurrentBookListInputModel();
                bookData.BookID = Guid.Parse(HttpContext.Session.GetString(SessionKeyBookID));
                bookData.BookDetailIDForDeleted = Guid.Parse(prevSite);
                bookData.Data = new List <AddItemToCurrentBookInputModel>();

                AddItemToCurrentBookInputModel Data = new AddItemToCurrentBookInputModel();
                Data.SitePriceID  = Guid.Parse(sitePriceID);
                Data.SiteID       = Guid.Parse(siteID);
                Data.SiteItemID   = Guid.Parse(siteItemID);
                Data.UserID       = Guid.Parse(HttpContext.Session.GetString(SessionKeyID));
                Data.StartDate    = DateTime.Parse(startDate);
                Data.EndDate      = DateTime.Parse(endDate);
                Data.Qty          = int.Parse(durasi);
                Data.Price        = double.Parse(price);
                Data.TotalPerItem = double.Parse(totalprice);
                bookData.Data.Add(Data);

                JsonConvert.SerializeObject(bookData);
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(BaseAPI + "Site/");
                    //HTTP POST
                    var postTask = client.PostAsJsonAsync <AddItemToCurrentBookListInputModel>("AddItemToCurrentBook", bookData);
                    postTask.Wait();

                    var result = postTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index", "Booking"));
                    }
                    else
                    {
                        TempData["CustomError"] = "Gagal menambah data. Mohon hubungi admin.";
                    }
                }
                return(Json(OutPutData));
            }
            else
            {
                TempData["CustomError"] = "Silakan masuk sebelum menggunakan situs web.";
                //if (HttpContext.Session.GetString(Loginfrom) == "ADM/SPV")
                //{
                //	return RedirectToAction("AdminLogon", "Login");
                //}
                //else if (HttpContext.Session.GetString(Loginfrom) == "MDO")
                //{
                //	return RedirectToAction("OwnerLogon", "Login");
                //}
                //else
                //{
                //	return RedirectToAction("OwnerLogon", "Login");
                //}
                return(RedirectToAction("Logon", "Login"));
            }
        }