コード例 #1
0
        public IHttpActionResult Get()
        {
            HttpContext context = HttpContext.Current;
            int         userID  = 0;
            UserQueries query   = new UserQueries();

            try
            {
                if (!context.Request["email"].Contains("@stenden.com") && context.Request["userType"].Equals(2))
                {
                    return(BadRequest("Stenden email address required for docent registration."));
                }

                userID = query.CreateUser();
                query.AddDocentData(userID);
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }
            if (userID != 0)
            {
                try
                {
                    query.SetPassword(userID, context.Request["password"]);
                }
                catch (Exception e)
                {
                    return(InternalServerError(e));
                }
            }
            else
            {
                return(InternalServerError());
            }
            return(Ok("Success"));
        }