コード例 #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));
        }
コード例 #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 }));
        }
コード例 #3
0
ファイル: CalendarController.cs プロジェクト: mrjohndowe/Core
        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 }));
        }