private HebbraCoDbfModel.HebbraCo16Model context = new HebbraCo16Model(); // A database context reference // Called when a HTTP GET request comes in at /BusinessUnit public IEnumerable <BusinessUnitDTO> Get() { var allBu = context.BusinessUnits.Where(b => b.Active == true); // Gets a collection of all Business Units where they are not soft deleted var dto = BusinessUnitDTO.buildList(allBu); // Passes the collection to the Business Unit Data Transfer Object to be formatted return(dto); // Returns the fomatted data (as JSON or XML, depending on which is chosen) }
public IQueryable <BusinessUnitDTO> GetBusinessUnit() { var allBu = db.BusinessUnits.Where(b => b.Active == true); var dto = BusinessUnitDTO.buildList(allBu); return(dto); }
public async Task <IHttpActionResult> GetBusinessUnit(int id) { var bu = db.BusinessUnits.Where(b => b.Active == true).Where(b => b.businessUnitId == id); IQueryable <BusinessUnitDTO> dto = BusinessUnitDTO.buildList(bu); if (!bu.Any()) { return(NotFound()); } return(Json(bu)); }