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