예제 #1
0
        public IActionResult AddMayor([FromBody] MayorDetailsDTO mayorDTO)
        {
            try {
                var newMayor = _mapper.Map <Mayor>(mayorDTO);
                _mayorRepository.AddMayor(newMayor);
                _mayorRepository.Save();
                return(Ok());
            }

            catch (Exception e) {
                return(BadRequest(e.Message));
            }
        }
예제 #2
0
        public IActionResult CreateMayor([FromBody] MayorDetailsDto mayorDto)
        {
            try
            {
                var entityMayor = _mapper.Map <Mayor>(mayorDto);
                _mayorRepository.AddMayor(entityMayor);
                _mayorRepository.Save();

                return(Ok());
            }

            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }