Exemple #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));
            }
        }
Exemple #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));
            }
        }