Exemplo n.º 1
0
        public ActionResult <IEnumerable <string> > DeleteCalendarOrganizer(LoginPost loginPost, long calendarId, long organizerId)
        {
            if (!auth.CheckIfCalendarPermissions(loginPost, calendarId))
            {
                return(Unauthorized());
            }

            var result = model.GetCalendarOrganizers(calendarId);

            if (result != null)
            {
                if (model.DeleteCalendarOrganizer(calendarId, organizerId))
                {
                    return(Ok());
                }
                else
                {
                    return(Conflict());
                }
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 2
0
        public ActionResult <IEnumerable <string> > GetParticipants(LoginPost loginPost, string eventUid)
        {
            var calId = new VeranstaltungenModel().GetCalendarId(eventUid);

            if (calId == -1)
            {
                return(NotFound());
            }

            if (!auth.CheckIfCalendarPermissions(loginPost, calId))
            {
                return(Unauthorized());
            }

            return(Content(model.GetParticipants(eventUid), "application/json"));
        }
        public ActionResult <IEnumerable <string> > GetBookings(LoginPost loginPost, string eventUid)
        {
            var eventId = new VeranstaltungenModel().GetEvent(eventUid);

            if (eventId == null)
            {
                return(NotFound());
            }

            var calendarId = new VeranstaltungenModel().GetCalendarId(eventUid);

            if (!auth.CheckIfCalendarPermissions(loginPost, calendarId))
            {
                return(Unauthorized());
            }

            var query = Request.QueryString.ToUriComponent();

            query = System.Web.HttpUtility.UrlDecode(query);

            var result = model.GetBookings(eventUid, query);

            if (result != null)
            {
                return(Content(result, "application/json"));
            }
            else
            {
                return(NotFound());
            }
        }
        public ActionResult <IEnumerable <string> > DeleteEvent(LoginPost loginPost, string calendar, string uid)
        {
            var calendarId = new KalenderModel().GetCalendarId(calendar);

            if (calendarId == -1)
            {
                return(NotFound());
            }

            if (!auth.CheckIfCalendarPermissions(loginPost, calendarId))
            {
                return(Unauthorized());
            }

            if (model.DeleteEvent(calendarId, uid))
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }