Exemplo n.º 1
0
        public ActionResult Action(int?ID)
        {
            AccomodationTypeActionModel model = new AccomodationTypeActionModel();

            if (ID.HasValue) //we are trying to edit a record
            {
                var accomodationType = accomodationTypesService.GetAccomodationTypeByID(ID.Value);
                model.ID          = accomodationType.ID;
                model.Name        = accomodationType.Name;
                model.Description = accomodationType.Description;
            }
            return(PartialView("_Action", model));
        }
        public ActionResult Action(int?ID)
        {
            AccomodationTypesAddOrEditModel model = new AccomodationTypesAddOrEditModel();

            if (ID.HasValue)
            {
                var accomodationType = accomodationTypesService.GetAccomodationTypeByID(ID.Value);

                model.ID          = accomodationType.ID;
                model.Name        = accomodationType.Name;
                model.Description = accomodationType.Description;
            }

            return(PartialView("_AddOrEdit", model));
        }
        // GET: Accomodations
        public ActionResult Index(int accomodationTypeID, int?accomodationPackageID)
        {
            AccomodationViewModel models = new AccomodationViewModel();

            models.AccomodationType              = accomodationTypesService.GetAccomodationTypeByID(accomodationTypeID);
            models.AccomodationPackages          = accomodationPackagesService.GetAllAccomodationPackagesByAccomodationType(accomodationTypeID);
            models.SelectedAccomodationPackageID = accomodationPackageID.HasValue ? accomodationPackageID.Value : models.AccomodationPackages.First().ID;
            models.Accomodations = accomodationsService.GetAllAccomodationsByAccomodationPackage(models.SelectedAccomodationPackageID);
            return(View(models));
        }