public IActionResult GetByAgency(int id) { var response = missionRepo.GetByAgency(id); if (response.Success) { var missions = new List <AgencyMissionsModel>(); foreach (var mission in response.Data) { missions.Add(new AgencyMissionsModel { MissionId = mission.MissionId, CodeName = mission.CodeName, StartDate = mission.StartDate, ActualEndDate = mission.ActualEndDate, ProjectedEndDate = mission.ProjectedEndDate, OperationalCost = mission.OperationalCost, Notes = mission.Notes, AgencyName = mission.Agency.ShortName }); } return(Ok(missions)); } else { return(BadRequest()); } }