// Insert new neighborhood to the databse public async Task<Neighborhood> Create(Neighborhood entity) { var neighborhood = _IRepositoryNeighborhood.FirstOrDefault(x => x.Id == entity.Id); if(neighborhood!=null) { throw new UserFriendlyException("NeighborHood already Exist"); } else { return await _IRepositoryNeighborhood.InsertAsync(entity); } }
// get all neighborhoods in the table database public IEnumerable<Neighborhood> getAllList() { var output = _IRepositoryNeighborhood.GetAll(); if (output == null) { var defaultList = new Neighborhood(); return (IEnumerable<Neighborhood>)defaultList; } else return output; }
// update neighborhood details public void Update(Neighborhood entity) { _IRepositoryNeighborhood.Update(entity); }