Exemplo n.º 1
0
        public ActionResult <IEnumerable <string> > PostCalendar(CalendarPost calendarPost)
        {
            var organizerId = auth.GetLoggedInOrganizer(calendarPost);

            if (!auth.CheckIfOrganizerPermissions(organizerId))
            {
                return(Unauthorized());
            }

            calendarPost.veranstalter = organizerId;
            var result = model.PostCalendar(calendarPost);

            if (result > 0)
            {
                var path = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/kalender/{result}";
                return(Created(path, null));
            }
            else
            {
                return(Conflict());
            }
        }