Ejemplo n.º 1
0
        public ActionResult <IEnumerable <string> > DeleteParticipant(LoginPost loginPost, string eventUid, long participationId)
        {
            var v       = new VeranstaltungenModel();
            var calId   = v.GetCalendarId(eventUid);
            var eventId = new BuchungenModel().GetEventId(eventUid);

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

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

            if (model.DeleteParticipant(new Dictionary <string, string> {
                { "veranstaltung", eventId }, { "nutzer", participationId.ToString() }
            }))
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
        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());
            }
        }
Ejemplo n.º 3
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 VeranstaltungenController()
 {
     model = new VeranstaltungenModel();
     auth  = new AuthModel();
 }