Beispiel #1
0
 public async Task <ActionResult <InviteViewModel> > Post([FromBody] InvitePayload value)
 {
     try
     {
         return(Ok(await inviteService.CreateInvite(value, this.UserId)));
     }
     catch (InviteException ex)
     {
         return(BadRequest(ex.Message));
     }
 }
        public async Task <JsonResult> CreateInvite([FromBody] InviteDto invite, [FromHeader] string token)
        {
            if (invite == null || string.IsNullOrEmpty(token))
            {
                Response.StatusCode = 400;
                return(new JsonResult("Bad Request"));
            }

            TokenDto tk = new TokenDto {
                AccessToken = token
            };

            var response = await _inviteService.CreateInvite(invite, tk);

            if (response.Errors != null)
            {
                Response.StatusCode = 401;
                return(new JsonResult(response.Errors));
            }

            Response.StatusCode = 200;
            return(new JsonResult(response.Result));
        }
Beispiel #3
0
 public static Invite CreateInvite(InviteDataStruct inviteData)
 {
     return(_current.CreateInvite(inviteData));
 }