public HttpResponseMessage SetCalendarAttendingStatus(CalendarItemAttendInput input) { var calendarItem = _calendarService.GetCalendarItemById(input.CalId); if (calendarItem == null) { throw HttpStatusCode.NotFound.AsException(); } if (calendarItem.DepartmentId != DepartmentId) { throw HttpStatusCode.Unauthorized.AsException(); } _calendarService.SignupForEvent(input.CalId, UserId, input.Note, input.Type); return(Request.CreateResponse(HttpStatusCode.Created)); }
public async Task <ActionResult> SetCalendarAttendingStatus(CalendarItemAttendInput input) { var calendarItem = await _calendarService.GetCalendarItemByIdAsync(input.CalId); if (calendarItem == null) { return(NotFound()); } if (calendarItem.DepartmentId != DepartmentId) { return(Unauthorized()); } var result = await _calendarService.SignupForEvent(input.CalId, UserId, input.Note, input.Type); return(CreatedAtAction(nameof(SetCalendarAttendingStatus), new { id = result.CalendarItemAttendeeId }, result)); }