public IActionResult Index() { IEnumerable <Team> Teams = TeamRepository.Get(); ViewBag.NewVacation = Vacationrepository.Count(x => !x.ConfirmedVacation); return(View(Teams)); }
public JsonResult GetEvents() { int vacationsCount = Vacationrepository.Count(); var events = new List <CalendarEventy>(); List <Vacation> vacations = new List <Vacation>(); IEnumerable <Person> people = PersonRepository.IncludeGet(p => p.Team); var colors = GetColors(people.Count()); int i = 0; foreach (Person person in people) { vacations = Vacationrepository.Get(p => p.Peopleid == person.Id).ToList(); DateTime start; DateTime end; var viewModel = new CalendarEventy(); foreach (Vacation vacation in vacations) { start = vacation.FirstDate; end = vacation.SecontDate; events.Add(new CalendarEventy() { Id = vacation.Id, allDay = true, title = "Vacation" + " " + person.LastName + " " + person.Name + " " + person.Team.TeamName, start = start.ToString("yyyy-MM-dd"), end = end.ToString("yyyy-MM-dd"), backgroundColor = vacation.ConfirmedVacation ? colors[i] : "red" }); } i++; } return(Json(events.ToArray())); }