Exemple #1
0
        public void Put(Guid id, [FromBody] Vacation vacation)
        {
            var vacationToRemove = VacationCalendar.getInstance().Vacations.FirstOrDefault(u => u.Id == vacation.Id);

            if (VacationCalendar.getInstance().Vacations.Remove(vacationToRemove))
            {
                VacationCalendar.getInstance().Vacations.Add(vacation);
            }
        }
        public void Put([FromBody] User user)
        {
            var userToRemove = VacationCalendar.getInstance().Users.FirstOrDefault(u => u.Id == user.Id);

            if (VacationCalendar.getInstance().Users.Remove(userToRemove))
            {
                VacationCalendar.getInstance().Users.Add(user);
            }
        }
Exemple #3
0
        public void Post([FromBody] Vacation vacation)
        {
            vacation.Id = Guid.NewGuid();

            if (vacation.UserId == Guid.Empty)
            {
                vacation.UserId = VacationCalendar.getInstance().Users.First().Id;
            }

            VacationCalendar.getInstance().Vacations.Add(vacation);
        }
Exemple #4
0
        public void Delete(Guid id)
        {
            var vacation = VacationCalendar.getInstance().Vacations.FirstOrDefault(u => u.Id == id);

            VacationCalendar.getInstance().Vacations.Remove(vacation);
        }
Exemple #5
0
 public Vacation Get(Guid id)
 {
     return(VacationCalendar.getInstance().Vacations.FirstOrDefault(v => v.Id == id));
 }
Exemple #6
0
        public IEnumerable <VacationDto> GetForCalendar()
        {
            var result = VacationCalendar.getInstance().GetVacationsCalendar();

            return(VacationCalendar.getInstance().GetVacationsCalendar());
        }
Exemple #7
0
 public IEnumerable <Vacation> Get()
 {
     return(VacationCalendar.getInstance().Vacations);
 }
        public void Delete(Guid id)
        {
            var user = VacationCalendar.getInstance().Users.FirstOrDefault(u => u.Id == id);

            VacationCalendar.getInstance().Users.Remove(user);
        }
        public void Post([FromBody] User user)
        {
            user.Id = Guid.NewGuid();

            VacationCalendar.getInstance().Users.Add(user);
        }
 public User Get(Guid id)
 {
     return(VacationCalendar.getInstance().Users.FirstOrDefault(u => u.Id == id));
 }
 public IEnumerable <User> Get()
 {
     return(VacationCalendar.getInstance().Users.OrderBy(u => u.LastName));
 }