public JsonResult GetEvents(Guid TeamId)
        {
            int vacationsCount = Vacationrepository.Count();
            int i                 = 1;
            var colors            = new List <string>();
            int integerRedValue   = 8;
            int integerGreenValue = 95;
            int integerBlueValue  = 52;

            for (int j = 0; j < vacationsCount; j++)
            {
                string hexValue = '#' + integerRedValue.ToString("X2") + integerGreenValue.ToString("X2") + integerBlueValue.ToString("X2");
                colors.Add(hexValue);
                integerBlueValue  += 24;
                integerGreenValue += 14;
                integerRedValue   += 41;
                if (integerBlueValue > 255)
                {
                    integerBlueValue = 0;
                }
                if (integerGreenValue > 255)
                {
                    integerGreenValue = 0;
                }
                if (integerRedValue > 255)
                {
                    integerRedValue = 0;
                }
            }
            var                  events    = new List <CalendarEventy>();
            List <Vacation>      vacations = new List <Vacation>();
            IEnumerable <Person> people    = Personrepository.Get(p => p.TeamId == TeamId).ToList();

            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              = Guid.NewGuid(),
                        allDay          = true,
                        title           = "Vacation" + " " + person.LastName + " " + person.Name,
                        start           = start.ToString("yyyy-MM-dd"),
                        end             = end.ToString("yyyy-MM-dd"),
                        backgroundColor = colors[i]
                    });
                }
                i++;
            }
            return(Json(events.ToArray()));
        }
        public void ChangeDateVacation([FromBody] CalendarEventy request)
        {
            string   start          = request.start.Substring(0, 10).Replace("-", "/");
            string   end            = request.end.Substring(0, 10).Replace("-", "/");
            Vacation updatevacation = Vacationrepository.FindById((Guid)request.Id);

            updatevacation.FirstDate  = DateTime.ParseExact(start, "yyyy/M/d", CultureInfo.InvariantCulture);
            updatevacation.SecontDate = DateTime.ParseExact(end, "yyyy/M/d", CultureInfo.InvariantCulture);
            Vacationrepository.Update(updatevacation);
        }
        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()));
        }
        public JsonResult GetEvents(Guid PersonId)
        {
            IEnumerable <Vacation> vacations = Vacationrepository.Get(p => p.Peopleid == PersonId);
            DateTime start;
            DateTime end;
            var      viewModel = new CalendarEventy();
            var      events    = new List <CalendarEventy>();
            int      numColors = 10;
            var      colors    = new List <string>();

            for (int j = 0; j < numColors; j++)
            {
                var random = new Random(); // Don't put this here!
                colors.Add(String.Format("#{0:X6}", random.Next(0x1000000)));
            }
            int i = 1;

            foreach (Vacation vacation in vacations)
            {
                start = vacation.FirstDate;
                end   = vacation.SecontDate;
                events.Add(new CalendarEventy()
                {
                    Id              = Guid.NewGuid(),
                    title           = "Vacation" + i,
                    start           = start.ToString("yyyy-MM-dd"),
                    end             = end.ToString("yyyy-MM-dd"),
                    allDay          = false,
                    backgroundColor = colors[i]
                });
                i++;
            }


            return(Json(events.ToArray()));
        }