public async Task <IActionResult> Create([FromBody] AccommodationViewModel viewModel) { var model = Mapper.Map <Accommodation>(viewModel); var createdModel = await _accommodationService.AddAsync(model); var createdViewModel = Mapper.Map <AccommodationViewModel>(createdModel); return(CreatedAtRoute( nameof(AccommodationController.GetById), new { id = createdViewModel.Id }, createdViewModel)); }
//[Authorize(Roles = "Accommodation-AddAccommodation")] public async Task <IActionResult> AddAccommodation([FromBody] AddAccommodationFormModel accommodationForm) { return(Ok(GetRequestResult(await _accommodationService.AddAsync(accommodationForm)))); }