Example #1
0
        public async Task <Repartidor> UpdateRepartidorAsync(int id, Repartidor repartidor)
        {
            if (id != repartidor.Id)
            {
                throw new NotFoundItemException($"not found repartidor with id:{id}");
            }
            var repartidorEntity = mapper.Map <RepartidorEntity>(repartidor);

            ARBRepository.UpdateRepartidorAsync(repartidorEntity);
            if (await ARBRepository.SaveChangesAsync())
            {
                return(mapper.Map <Repartidor>(repartidorEntity));
            }
            throw new Exception("there were an error with the BD");
        }