public async Task <IActionResult> LoadCottageEditForm(int cottid)
        {
            //TODO: Refactor.
            var cottage = await _cottageRepository.GetCottageWithImagesAsync(cottid);

            var vm = new CottageFormViewModel {
                Cottage = new Cottage()
            };

            vm.Cottage = cottage;
            return(View("Forms/CottageEditForm", vm));
        }
Beispiel #2
0
        public async Task <IActionResult> LoadEnquirePage(int cottageid, List <string> errors = null)
        {
            var vm = new EnquireFormViewModel
            {
                Booking =
                {
                    Cottage = await _cottageRepository.GetCottageWithImagesAsync(cottageid), CottageId = cottageid
                },
                Username = HttpContext.User.Claims
                           .FirstOrDefault(c => c.Type == ClaimTypes.Email)?
                           .Value
            };

            if (errors != null)
            {
                vm.Errors = errors;
            }

            return(View("_EnquirePage", vm));
        }