Exemple #1
0
        public HttpResponseMessage Post(int forumId, signupParams sign)
        {
            try
            {
                var userId = driver.Register(sign.username, sign.password, sign.email, forumId);
                var data   = new
                {
                    id       = userId,
                    username = sign.username,
                    type     = "member"
                };

                var result = new
                {
                    data = data
                };

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result);
                return(response);
            }
            catch (Exception e)
            {
                var data = new
                {
                    message = e.Message
                };
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NotFound, data);
                return(response);
            }
        }
Exemple #2
0
        public IHttpActionResult Post(int forumId, signupParams sign)
        {
            try
            {
                var userId = driver.Register(sign.username, sign.password, sign.email, forumId);
                var data   = new
                {
                    id       = userId,
                    username = sign.username,
                    type     = "member"
                };

                var result = new
                {
                    data = data
                };

                return(Ok(result));
            }
            catch
            {
                return(NotFound());
            }
        }