Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }