예제 #1
0
        public async Task <IActionResult> AddHome(HomeDto homeDto)
        {
            if (await _appRepository.CheckHomeName(homeDto.Name))
            {
                return(BadRequest($"Home {homeDto.Name.ToUpper()} already exists in database."));
            }

            var home = _mapper.Map <Home>(homeDto);

            _appRepository.Add(home);

            await _unitOfWork.SaveAll();

            return(Ok(home));
        }