private static List <VwHoursEntered> GetData(HoursEnteredParams Params)
 {
     using var db = new ModelContext();
     return(db.VwHoursEntered
            .Where(x => Params.UserName == null ||
                   Params.UserName == "All" ||
                   x.Username == Params.UserName)
            .Where(x => Params.ProjectTitle == null ||
                   Params.ProjectTitle == "All" ||
                   x.ProjectTitle == Params.ProjectTitle)
            .Where(x => Params.StartDate == null ||
                   x.WorkDate >= Params.StartDate.Value)
            .Where(x => Params.EndDate == null ||
                   x.WorkDate <= Params.EndDate.Value.AddDays(1))
            .ToList());
 }
 public IActionResult Get(HoursEnteredParams Params)
 {
     return(base.Ok(GetData(Params)));
 }
        public IActionResult GetExcel(HoursEnteredParams Params)
        {
            var data = GetData(Params);

            return(File(ExcelService.GenerateExcelWorkbook(data), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
        }
Esempio n. 4
0
 public async Task <HttpResponseMessage> GetHoursEnteredExcel(HoursEnteredParams para)
 {
     return(await http.PostAsJsonAsync("api/reports/hours-entered/excel", para));
 }