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); } }
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); }
public void Delete(Guid id) { var vacation = VacationCalendar.getInstance().Vacations.FirstOrDefault(u => u.Id == id); VacationCalendar.getInstance().Vacations.Remove(vacation); }
public Vacation Get(Guid id) { return(VacationCalendar.getInstance().Vacations.FirstOrDefault(v => v.Id == id)); }
public IEnumerable <VacationDto> GetForCalendar() { var result = VacationCalendar.getInstance().GetVacationsCalendar(); return(VacationCalendar.getInstance().GetVacationsCalendar()); }
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)); }