public ActionResult Create(RentBook data)
        {
            var listBooks   = BookMgr.GetListBook();
            var bookOptions = new SelectList(listBooks.Select(org =>
            {
                return(new SelectListItem {
                    Text = org.BookTitle, Value = org.ID.ToString()
                });
            }), "Value", "Text");

            ViewData["BookOptions"] = bookOptions;

            var book = BookMgr.GetBookByID(data.BookID);

            data.RentLenght  = (data.EndDate - data.StartDate).Days;
            data.PricePerDay = book.RentPrice;
            data.UserName    = User.Identity.Name;

            RentMgr.Create(data);

            ModelState.Clear();
            TempData["Message"] = "rent successfully saved";

            return(View(data));
        }
        public async Task <IActionResult> CalculatePrice(int bookId, DateTime dateStart, DateTime dateEnd)
        {
            Book data     = BookMgr.GetBookByID(bookId);
            int  dateDiff = (dateEnd - dateStart).Days;

            try
            {
                CalculatorSoapClient calculator = new CalculatorSoapClient(CalculatorSoapClient.EndpointConfiguration.CalculatorSoap12);
                var result = await calculator.MultiplyAsync(Convert.ToInt32(data.RentPrice), dateDiff);

                return(Json(result));;
            }
            catch (Exception)
            {
                var result = Convert.ToInt32(data.RentPrice) * dateDiff;
                return(Json(result));;
            }
        }