Ejemplo n.º 1
0
        public bool Remove(int id)
        {
            City removeCity = _cityRepo.Read(id);

            if (removeCity != null)
            {
                return(_cityRepo.Delete(removeCity));
            }
            return(false);
        }
Ejemplo n.º 2
0
        public bool Remove(int id)
        {
            City city = _cityRepo.Read(id);

            if (city == null)
            {
                return(false);
            }
            else
            {
                return(_cityRepo.Delete(city));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> DeleteCityByID(int id)
        {
            try
            {
                var oldCity = await _cityRepo.GetCityById(id);

                if (oldCity == null)
                {
                    return(NotFound($"Couldn't find any city with id: {id}"));
                }

                _cityRepo.Delete(oldCity);

                if (await _cityRepo.Save())
                {
                    return(NoContent());
                }
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}"));
            }
            return(BadRequest());
        }
Ejemplo n.º 4
0
 public bool Remove(int id)
 {
     return(_cityRepo.Delete(id));
 }
Ejemplo n.º 5
0
 public void DeleteCity(int id)
 {
     cityRepo.Delete(id);
 }
Ejemplo n.º 6
0
 public async Task <bool> DeleteCityAsync(City city)
 {
     _cityRepo.Delete(city);
     return(await SaveChangesAsync());
 }