public ActionResult IndexSave(long?idb, long?idp)
        {//long propertyId, long BookingId
            try
            {
                long cid = 0;
                long.TryParse(User.Identity.GetUserId(), out cid);
                Models.ReviewModel data = new Models.ReviewModel();

                if (idb > 0)
                {
                    data.BookingId = idb.Value;
                }
                if (idp > 0)
                {
                    data.PropertyId = idp.Value;
                    if (data.PropertyId > 0)
                    {
                        CLayer.Property pro = BLayer.Property.Get(data.PropertyId);
                        if (pro != null)
                        {
                            if (pro.City != null)
                            {
                                data.AccommodationCity = pro.City;
                            }
                        }
                    }
                }
                return(View("~/Views/Review/Save.cshtml", data));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(Redirect("~/Admin/ErrorPage"));
            }
        }
        public ActionResult ReviewForm(string referenceno)
        {
            try
            {
                long cid = 0;
                long.TryParse(User.Identity.GetUserId(), out cid);

                Models.ReviewModel data = new Models.ReviewModel();
                if (referenceno != null && referenceno != "")
                {
                    data.BookingId  = BLayer.Bookings.GetBookingIdByOrder(referenceno);
                    data.PropertyId = BLayer.Bookings.GetPropertyId(data.BookingId);
                    if (data.PropertyId > 0)
                    {
                        CLayer.Property pro = BLayer.Property.Get(data.PropertyId);
                        if (pro != null)
                        {
                            if (pro.City != null)
                            {
                                data.AccommodationCity = pro.City;
                            }
                        }
                    }
                }
                ViewBag.redirection = "Fromemail";
                return(View("~/Views/Review/Save.cshtml", data));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                return(Redirect("~/Admin/ErrorPage"));
            }
        }
        public ActionResult SaveData(Models.ReviewModel data)
        {
            try
            {
                ViewBag.LoginError = false;
                ViewBag.GuestError = false;
                long cid = 0;
                long.TryParse(User.Identity.GetUserId(), out cid);
                //if (ModelState.IsValid)
                //{
                CLayer.Review d = new CLayer.Review()
                {
                    PropertyId  = data.PropertyId,
                    UserId      = cid,
                    BookingId   = data.BookingId,
                    Rating      = data.Rating,
                    Description = data.Description,
                    Status      = (int)CLayer.ObjectStatus.StatusType.NotVerified,
                    // ReviewDate = DateTime.Now
                    AccommodationCity = data.AccommodationCity,
                    Accessibility     = data.Accessibility,
                    Easiness          = data.Easiness,
                    CleanlinessBed    = data.CleanlinessBed,
                    CleanlinessBath   = data.CleanlinessBath,
                    SleepQuality      = data.SleepQuality,
                    Staffbehave       = data.Staffbehave,
                    OverallExp        = data.OverallExp,
                    Considerfornext   = data.Considerfornext
                };
                long idsch = BLayer.Review.Chechreviewids(d);


                if (idsch > 0)
                {
                    ViewBag.LoginError = true;
                    ViewBag.Message    = "Review Already saved";
                    data.message1      = "Review Already saved";
                    ViewBag.Saved      = true;
                    //return RedirectToAction("IndexSave");
                }
                else
                {
                    ViewBag.LoginError = true;
                    ViewBag.Message    = "Waiting for verification";
                    data.message1      = "Waiting for verification";
                    ViewBag.Saved      = true;
                    BLayer.Review.Save(d);
                }
                return(RedirectToAction("Index", "BookingHistory"));
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                //return Redirect("~/Admin/ErrorPage");
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Pager(Models.ReviewModel data)
        {
            long cid = 0;

            long.TryParse(User.Identity.GetUserId(), out cid);
            Models.ReviewModel   search = new Models.ReviewModel();
            List <CLayer.Review> users  = BLayer.Review.GetGetUserId((data.currentPage - 1) * data.Limit, data.Limit, cid, (int)CLayer.ObjectStatus.StatusType.Verified);

            search.TotalRows  = 0;
            search.ReviewList = users;
            if (users.Count > 0)
            {
                search.TotalRows = users[0].TotalRows;
            }
            search.Limit       = 25;
            search.currentPage = data.currentPage;
            ViewBag.Filter     = search;
            return(View(search));
        }