예제 #1
0
        public ActionResult <IEnumerable <string> > PostAdmin(AdminsPost adminsPost)
        {
            if (!auth.CheckIfAdminPermissions(adminsPost))
            {
                return(Unauthorized());
            }

            var id     = adminsPost.veranstalter;
            var result = model.PostAdmin(id);

            if (result)
            {
                var path = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/admins/{id}";
                return(Created(path, null));
            }
            else
            {
                return(BadRequest());
            }
        }