public async Task <ActionResult <IEnumerable <Agency> > > GetAllAsync( [FromServices] IAgencyRepository repository, [FromQuery] PagedAgencyParameters pageParameters, [FromQuery] bool?isCapital, [FromQuery] bool?isStation, [FromQuery] bool?isOpen ) { var agencies = await repository.GetAll( pageParameters, isCapital, isStation, isOpen ); var metadata = new { agencies.TotalCount, agencies.PageSize, agencies.CurrentPage, agencies.TotalPages, agencies.HasNext, agencies.HasPrevious }; Response.Headers.Add( "X-Pagination", JsonSerializer.Serialize(metadata) ); return(Ok(agencies)); }
public IActionResult Index() { List <Agency> agencies = agencyRepository.GetAll().Data; List <SecurityClearance> clearances = securityRepo.GetAll().Data; ViewBag.ListOfAgencies = agencies; ViewBag.ListOfClearances = clearances; return(View()); }
public IActionResult Index() { var result = _agencyRepository.GetAll(); if (result.Success) { return(View(result.Data)); } else { throw new Exception(result.Messages[0]); } }
public IActionResult Index() { var response = agencyRepo.GetAll(); if (response.Success) { return(View(response.Data)); } else { return(BadRequest(response.Message)); } }
public async Task UpdateAccountAsync(UserContextModel userContext, JsonPatchDocument <UpdateAgencyRequestModel> jsonPatch, CancellationToken ct) { Agency agency = await _agencyRepository.GetAll().Where(x => x.Id == userContext.AgencyId).Include (x => x.Employees).FirstOrDefaultAsync(); UpdateAgencyRequestModel jsonPatchDTO = _mapper.Map <UpdateAgencyRequestModel>(agency); jsonPatch.ApplyTo(jsonPatchDTO); _mapper.Map(jsonPatchDTO, agency); _agencyRepository.Update(agency); await _unitOfWork.SaveChangesAsync(); //return jsonPatchDTO; }
public ResponseEntityVM GetAll() { try { var agencyList = _repository.GetAll(); return(new ResponseEntityVM() { StatusCode = System.Net.HttpStatusCode.OK, Result = _mapper.Map <IEnumerable <AgencyVM> >(agencyList) }); } catch (Exception ex) { return(new ResponseEntityVM() { StatusCode = System.Net.HttpStatusCode.InternalServerError, Message = $"There was an error getting the Agencies: {ex.Message}" }); } }
public Agency[] Retrieve(GetAgenciesQuery query) { return(_agencyRepository.GetAll().ToArray()); }
public IList <Agency> GetAll() { return(_agencyRepository.GetAll()); }