public async Task <IActionResult> Create(PropertyModel model)
        {
            if (ModelState.IsValid)
            {
                var property = _mapper.Map <Property>(model);

                await _propertyService.CreateAsync(property);

                return(RedirectToAction(nameof(Details), new { id = property.Id }));
            }

            await PrepareModelAsync(model);

            return(View(model));
        }
Esempio n. 2
0
        public async Task <ActionResult <PropertyDto> > Create([FromBody] PropertyDto propertyDto)
        {
            var property = await propertyService.CreateAsync(propertyDto);

            return(Ok(property));
        }