public async System.Threading.Tasks.Task <OperationResult <Equipment> > GetEquipment(int pageSize, int pageNumber, bool descending) { return(await System.Threading.Tasks.Task.Factory.StartNew <OperationResult <Equipment> >(() => { OperationResult <Equipment> result = new OperationResult <Equipment>(); try { if (IsInCompany()) { result.Count = EquipmentsRepository.Count("CompanyId = @CompanyId", new { CompanyId = CurrentUser.CompanyId }); if (result.Count > 0) { result.MultipleResult = EquipmentsRepository.Search("CompanyId = @CompanyId", new { PageSize = pageSize, PageNumber = pageNumber, CompanyId = CurrentUser.CompanyId }, descending); } result.Result = true; } } catch (Exception ex) { LoggingService.Log(ex); } return result; })); }
public async System.Threading.Tasks.Task <OperationResult <OrderResponse> > GetCompanyForOrder(int id) { return(await System.Threading.Tasks.Task.Factory.StartNew <OperationResult <OrderResponse> >(() => { OperationResult <OrderResponse> result = new OperationResult <OrderResponse>(); try { var company = CompaniesRepository.Read(id); if (company != null) { company.OwnerId = Guid.Empty; company.Description = ""; company.LogoImage = ""; var playgrounds = PlaygroundsRepository.Search("CompanyId = @CompanyId", new { PageNumber = 1, PageSize = 100, CompanyId = company.Id }); var gameTypes = GameTypesRepository.Search("CompanyId = @CompanyId", new { PageNumber = 1, PageSize = 100, CompanyId = company.Id }); var equipment = EquipmentsRepository.Search("CompanyId = @CompanyId", new { PageNumber = 1, PageSize = 100, CompanyId = company.Id }); foreach (var equip in equipment) { equip.State = ""; } result.SingleResult = new OrderResponse { Company = company, Playgrounds = playgrounds, GameTypes = gameTypes, Equipment = equipment }; result.Result = true; } } catch (Exception ex) { LoggingService.Log(ex); } return result; })); }