public ActionResult Delete(int Id)
        {
            AccomodationPackagesModels models = new AccomodationPackagesModels();
            var accomodationType = AccomodationPackagesServices.Instance.GetById(Id);

            models.Id = accomodationType.Id;
            return(PartialView("_Delete", models));
        }
        public JsonResult Action(AccomodationPackagesModels model)
        {
            JsonResult          json   = new JsonResult();
            AccomodationPackage models = new AccomodationPackage();

            List <int> picIds   = !string.IsNullOrEmpty(model.PicTureIds)? model.PicTureIds.Split(',').Select(z => int.Parse(z)).ToList() : new List <int>();
            var        pictures = DashboardServices.Instance.GetPicBtIds(picIds);


            var result = false;

            if (model.Id > 0)
            {
                models.Id                        = model.Id;
                models.Name                      = model.Name;
                models.NoOfRooms                 = model.NoOfRooms;
                models.PerNight                  = model.PerNight;
                models.AccomodationTypeId        = model.AccomodationTypeId;
                models.Details                   = model.Details;
                models.AccomodationPackageImages = new List <AccomodationPackageImage>();
                models.AccomodationPackageImages.AddRange(pictures.Select(x => new AccomodationPackageImage()
                {
                    AccomodationPackageId = models.Id, ImageId = x.Id
                }));

                result = AccomodationPackagesServices.Instance.Edit(models);
            }
            else
            {
                models.Name               = model.Name;
                models.NoOfRooms          = model.NoOfRooms;
                models.PerNight           = model.PerNight;
                models.AccomodationTypeId = model.AccomodationTypeId;
                models.Details            = model.Details;

                models.AccomodationPackageImages = new List <AccomodationPackageImage>();
                models.AccomodationPackageImages.AddRange(pictures.Select(x => new AccomodationPackageImage()
                {
                    ImageId = x.Id
                }));
                result = AccomodationPackagesServices.Instance.Save(models);
            }

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable To Add Accomodation Type" };
            }
            return(json);
        }
        public ActionResult Action(int?Id)
        {
            AccomodationPackagesModels models = new AccomodationPackagesModels();

            if (Id.HasValue)
            {
                var accomodationType = AccomodationPackagesServices.Instance.GetById(Id.Value);
                models.Id                        = accomodationType.Id;
                models.Name                      = accomodationType.Name;
                models.NoOfRooms                 = accomodationType.NoOfRooms;
                models.PerNight                  = accomodationType.PerNight;
                models.AccomodationTypeId        = accomodationType.AccomodationTypeId;
                models.Details                   = accomodationType.Details;
                models.AccomodationPackageImages = AccomodationPackagesServices.Instance.GetPicByAccomodationId(accomodationType.Id);
            }
            models.AccomodationTypes = AccomodationTypesServices.Instance.GetAllAccomodationTypes();
            return(PartialView("_Action", models));
        }