public ActionResult CustomerBookingGetById(int Id)
        {
            try
            {
                customerBookingViewModel.Id = Id;
                var customerResult = webServices.Post(customerBookingViewModel, "CustomerBooking/CustomerBookingGetById");

                if (customerResult.StatusCode == System.Net.HttpStatusCode.Accepted)
                {
                    customerBookingViewModel = (new JavaScriptSerializer().Deserialize <CustomerBookingViewModel>(customerResult.Data.ToString()));
                }

                CompanyController     companyController     = new CompanyController();
                ProductController     productController     = new ProductController();
                ProductUnitController productUnitController = new ProductUnitController();

                ViewBag.Companies    = companyController.Companies();
                ViewBag.Products     = productController.Products();
                ViewBag.ProductUnits = productUnitController.ProductUnits();

                return(View(customerBookingViewModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult AdminCreate()
        {
            CompanyController     companyController     = new CompanyController();
            ProductController     productController     = new ProductController();
            ProductUnitController productUnitController = new ProductUnitController();

            ViewBag.Companies    = companyController.Companies();
            ViewBag.Products     = productController.Products();
            ViewBag.ProductUnits = productUnitController.ProductUnits();

            CustomerBookingViewModel CustomerBookingViewModel = new CustomerBookingViewModel
            {
                VAT         = (decimal)0.00,
                TotalAmount = (decimal)0.00,
            };

            return(View(CustomerBookingViewModel));
        }
        public ActionResult CustomerCreate(CustomerBookingViewModel customerBookingViewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    ProductController     productController     = new ProductController();
                    ProductUnitController productUnitController = new ProductUnitController();

                    ViewBag.Products     = productController.Products();
                    ViewBag.ProductUnits = productUnitController.ProductUnits();

                    if (customerBookingViewModel.IsAwfuelAdmin == "IsAwfuelAdmin")
                    {
                        if (customerBookingViewModel.CompanyId == 0)
                        {
                            ModelState.AddModelError("CompanyId", "Please select customer");
                        }
                        CompanyController companyController = new CompanyController();
                        ViewBag.Companies = companyController.Companies();
                        return(View("AdminCreate", customerBookingViewModel));
                    }
                    else
                    {
                        return(View("CustomerCreate", customerBookingViewModel));
                    }
                }
                else
                {
                    if (customerBookingViewModel.IsAwfuelAdmin == "IsAwfuelAdmin")
                    {
                        if (customerBookingViewModel.CompanyId == 0)
                        {
                            CompanyController     companyController     = new CompanyController();
                            ProductController     productController     = new ProductController();
                            ProductUnitController productUnitController = new ProductUnitController();

                            ViewBag.Companies    = companyController.Companies();
                            ViewBag.Products     = productController.Products();
                            ViewBag.ProductUnits = productUnitController.ProductUnits();

                            ModelState.AddModelError("CompanyId", "Please select customer");

                            return(View("AdminCreate", customerBookingViewModel));
                        }
                    }
                    var CustomerResult = new ServiceResponseModel();
                    customerBookingViewModel.CreatedBy = Convert.ToInt32(Session["UserId"]);
                    if (customerBookingViewModel.IsAwfuelAdmin != "IsAwfuelAdmin")
                    {
                        customerBookingViewModel.CompanyId = Convert.ToInt32(Session["CompanyId"]);
                    }
                    CustomerResult = webServices.Post(customerBookingViewModel, "CustomerBooking/CustomerBookingAdd");

                    if (CustomerResult.StatusCode == System.Net.HttpStatusCode.Accepted)
                    {
                        var reuslt = (new JavaScriptSerializer().Deserialize <int>(CustomerResult.Data));

                        if (customerBookingViewModel.IsAwfuelAdmin == "IsAwfuelAdmin")
                        {
                            return(RedirectToAction(nameof(Index)));
                        }
                        else
                        {
                            return(RedirectToAction(nameof(Customer)));
                        }
                    }

                    return(View(customerBookingViewModel));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }