public IActionResult GetWarrantiesGridData(DateTime startDate, DateTime endDate, Guid?teamId) { List <Models.Warranty.WarrantiesGridRow> rows = new List <Models.Warranty.WarrantiesGridRow>(); List <IWarrantyDisplay> displays; if (teamId.HasValue) { displays = WarrantyService.GetWarranyDisplaysByTeamId(teamId.Value, startDate, endDate); } else { displays = WarrantyService.GetWarrantyDisplays(startDate, endDate); } foreach (var item in displays) { rows.Add(new Models.Warranty.WarrantiesGridRow(item)); } return(Json(new { data = rows })); }