Exemple #1
0
        public async Task <ActionResult <eAnuncioWebMotors> > Add([FromBody] eAnuncioWebMotors AnuncioWebMotors)
        {
            try
            {
                var Anuncio = await _AnuncioWebMotorsRepo.Add(AnuncioWebMotors);

                return(Ok(Anuncio));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(StatusCode(500));
            }
        }
Exemple #2
0
        public async Task <ActionResult <eAnuncioWebMotors> > Update([FromBody] eAnuncioWebMotors AnuncioWebMotors)
        {
            try
            {
                var AnuncioUpdt = await _AnuncioWebMotorsRepo.Get(AnuncioWebMotors.ID);

                if (AnuncioUpdt == null)
                {
                    return(NotFound());
                }

                AnuncioUpdt.Update(AnuncioWebMotors);

                await _AnuncioWebMotorsRepo.Update(AnuncioUpdt);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(StatusCode(500));
            }
        }