コード例 #1
0
        public async Task <IActionResult> Save(
            PropertyModel propertyModel)
        {
            var propertyDto = _mapper.Map <PropertyDto>(propertyModel);
            var wasAdded    = await _propertyManager.AddPropertyAsync(propertyDto);

            if (!wasAdded)
            {
                SetMessage(string.Format(Constants.ErrorPropertyAlreadyCreated, propertyModel.Id));
            }
            else
            {
                SetMessage(string.Format(Constants.SucessPropertyCreated, propertyModel.Id));
            }

            return(RedirectToAction(nameof(Index)));
        }