Beispiel #1
0
        public IActionResult View(int calendarItemId)
        {
            var model = new CalendarItemView();

            model.CalendarItem = _calendarService.GetCalendarItemById(calendarItemId);

            if (model.CalendarItem == null)
            {
                Unauthorized();
            }

            model.CalendarItem.Description = StringHelpers.SanitizeHtmlInString(model.CalendarItem.Description);

            model.UserId     = UserId;
            model.Department = _departmentsService.GetDepartmentById(DepartmentId, false);

            var recurrences = _calendarService.GetAllV2CalendarItemRecurrences(calendarItemId);

            if (recurrences != null && recurrences.Any())
            {
                model.IsRecurrenceParent = true;
            }

            model.CanEdit = _authorizationService.CanUserModifyCalendarEntry(UserId, calendarItemId);

            if (model.CalendarItem.DepartmentId != DepartmentId)
            {
                Unauthorized();
            }

            return(View(model));
        }
Beispiel #2
0
        public IActionResult Signup(CalendarItemView model)
        {
            _calendarService.SignupForEvent(model.CalendarItem.CalendarItemId, UserId, model.Note, (int)CalendarItemAttendeeTypes.RSVP);

            return(RedirectToAction("View", new { calendarItemId = model.CalendarItem.CalendarItemId }));
        }
Beispiel #3
0
        public async Task <IActionResult> Signup(CalendarItemView model, CancellationToken cancellationToken)
        {
            await _calendarService.SignupForEvent(model.CalendarItem.CalendarItemId, UserId, model.Note, (int)CalendarItemAttendeeTypes.RSVP, cancellationToken);

            return(RedirectToAction("View", new { calendarItemId = model.CalendarItem.CalendarItemId }));
        }