Пример #1
0
        public JsonResult Accomodation(AccomodationViewModel model)
        {
            positionSetReq = new PositionSetReq();
            

            if (model.SaveType == "partial")
            {
                model.AccomodationData.RemoveAll(x => (x.AccomodationSequence == 0));
            }
            else if (model.SaveType == "full")
            {
                model.AccomodationData.RemoveAll(x => (x.AccomodationSequence == 0 && string.IsNullOrEmpty(x.AccomodationId)));
            }
            bool IsValid = accomoMapping.ValidateAccomodationWithRouting(model, token);
            if (IsValid)
            {
                positionSetReq = accomoMapping.AccomodationSet(model, ckUserEmailId,token);
                positionSetReq.FOC = model.FOC;
                positionSetReq.Price = model.Price;
                positionSetReq.QRFID = model.MenuViewModel.QRFID;
                positionSetReq.VoyagerUserID = ckLoginUser_Id;
                positionSetRes = positionProviders.SetPosition(positionSetReq, token).Result;
                if (positionSetRes.ResponseStatus.Status.ToLower() == "success")
                {
                    if (model.SaveType == "partial")
                    {
                        return Json(new { RoomDetailsInfo = positionSetRes.mPosition[0].RoomDetailsInfo, PositionId = positionSetRes.mPosition[0].PositionId });
                    }
                    else
                    {
                        return Json(positionSetRes.ResponseStatus);
                    }
                }
                else
                {
                    if (model.SaveType == "partial")
                    {
                        return Json(new { RoomDetailsInfo = positionSetRes.mPosition[0].RoomDetailsInfo, PositionId = positionSetRes.mPosition[0].PositionId });
                    }
                    else
                    {
                        return Json(positionSetRes.ResponseStatus);
                    }
                }

            }
            else
            {
                return Json(new { status = "Invalid" });
            }

        }