public bool Remove(int id)
        {
            Country removeCountry = _countryRepo.Read(id);

            if (removeCountry != null)
            {
                return(_countryRepo.Delete(removeCountry));
            }
            return(false);
        }
Пример #2
0
        public bool Remove(int id)
        {
            Country country = _countryRepo.Read(id);

            if (country == null)
            {
                return(false);
            }
            else
            {
                return(_countryRepo.Delete(country));
            }
        }
        public async Task <ActionResult> DeleteCountryByID(int id)
        {
            try
            {
                var oldCountry = await _countryRepo.GetCountryById(id);

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

                _countryRepo.Delete(oldCountry);

                if (await _countryRepo.Save())
                {
                    return(NoContent());
                }
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}"));
            }
            return(BadRequest());
        }
Пример #4
0
 public IActionResult Delete(CountryVM model)
 {
     _countryRepos.Delete(model.Id);
     return(RedirectToAction("Index"));
 }
Пример #5
0
 public bool Remove(int id)
 {
     return(_countryRepo.Delete(id));
 }