public void DeleteCity(string city) { var getCity = _citiesRepository.GetFirstWhere(x => x.City.ToLower() == city.ToLower().Trim()); if (getCity == null) { throw new FlowException("Градот не е пронајден!"); } _citiesRepository.Remove(getCity); _citiesRepository.SaveEntities(); }
public object Delete(City deleted) { object json; try { bool result = repository.Remove(deleted); json = new { success = result }; } catch (Exception ex) { json = new { success = false, message = ex.Message }; } return(json); }