public SharePostUnitOfWork(DataContext context) { this.Context = context; SharePosts = new SharePostRepository(Context); Addresses = new AddressRepository(Context); ShareTypes = new ShareTypeRepository(Context); Genders = new GenderRepository(Context); Places = new PlaceRepository(Context); Suburbs = new SuburbRepository(Context); Pictures = new PictureRepository(Context); }
public SuburbEntity SelectSuburbById(int SuburbId) { try { SuburbEntity returnedEntity; using (var repository = new SuburbRepository()) { returnedEntity = repository.SelectById(SuburbId); } return(returnedEntity); } catch (Exception ex) { //Log exception error _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true); throw new Exception("BusinessLogic:SuburbBusiness::SelectSuburbById::Error occured.", ex); } }
public bool UpdateSuburb(SuburbEntity entity) { try { bool bOpDoneSuccessfully; using (var repository = new SuburbRepository()) { bOpDoneSuccessfully = repository.Update(entity); } return(bOpDoneSuccessfully); } catch (Exception ex) { //Log exception error _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true); throw new Exception("BusinessLogic:SuburbBusiness::UpdateSuburb::Error occured.", ex); } }
public List <SuburbEntity> SelectAllSuburbs() { var returnedEntities = new List <SuburbEntity>(); try { using (var repository = new SuburbRepository()) { foreach (var entity in repository.SelectAll()) { returnedEntities.Add(entity); } } return(returnedEntities); } catch (Exception ex) { //Log exception error _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true); throw new Exception("BusinessLogic:SuburbBusiness::SelectAllSuburb::Error occured.", ex); } }
public SuburbsController(SuburbRepository suburbRepository) { _suburbRepository = suburbRepository; }
public List <Suburb> GetAllSuburbs() { SuburbRepository repo = new SuburbRepository(); return(repo.GetAllSuburbs()); }