Exemplo n.º 1
0
        public ActionResult GetPriceDetails(Guid roomTypeId, Guid rateTypeId)
        {
            try
            {
                var weekDayPrice = rateRepository.GetWeekDayPrice(roomTypeId, rateTypeId).FirstOrDefault();

                var weekEndPrice = rateRepository.GetWeekEndPrice(roomTypeId, rateTypeId).FirstOrDefault();

                if (weekDayPrice != null || weekEndPrice != null)
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            WeekDayPrice = (weekDayPrice != null ? weekDayPrice.Amount : 0),
                            WeekEndPrice = (weekEndPrice != null ? weekEndPrice.Amount : 0)
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Price details not found."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "GetPriceDetails");
                return(Json(new { IsSuccess = false, errorMessage = e.Message }));
            }
        }
Exemplo n.º 2
0
        public JsonResult GetWeekDayPrice(Guid roomTypeId, Guid rateTypeId)
        {
            try
            {
                //Get Week Day Price.
                var rate = rateRepository.GetWeekDayPrice(roomTypeId, rateTypeId).FirstOrDefault();

                return(Json(new
                {
                    IsSuccess = true,
                    data = rate
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "GetWeekDayPrice");
                return(Json(new { IsSuccess = false, errorMessage = e.Message }));
            }
        }