Esempio n. 1
0
        // POST api/users
        public ReturnValue Post([FromBody] Users value)
        {
            if (value == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            ReturnValue returnValue = new ReturnValue();

            try
            {
                entity.UserCreate(value.PhoneHash, value.PushKey, value.DeviceID);

                returnValue.code = 0;
                returnValue.msg  = "succes";
            }
            catch
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }

            return(returnValue);
        }
Esempio n. 2
0
        public ReturnValue create([FromBody] RequestValue value)
        {
            if (value == null)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            CreateUser createUser = JsonConvert.DeserializeObject <CreateUser>(Convert.ToString(value.data));
            string     strGUID    = Guid.NewGuid().ToString().Replace("-", string.Empty);

#if DEBUG
            if (value.token.Equals("A1234567890"))
            {
                strGUID = "guid1";
            }
            if (value.token.Equals("B1234567890"))
            {
                strGUID = "guid2";
            }
            if (value.token.Equals("C1234567890"))
            {
                strGUID = "guid3";
            }
            if (value.token.Equals("D1234567890"))
            {
                strGUID = "guid4";
            }
            if (value.token.Equals("E1234567890"))
            {
                strGUID = "guid5";
            }
#endif
            try
            {
                ObjectParameter userSN = new ObjectParameter("UserSN", typeof(long));

                // 사용자 정보 등록
                entity.UserCreate(userSN, value.token, strGUID, createUser.user.hashphone, createUser.user.deviceid, createUser.user.pushkey);

                /*
                 * ObjectParameter userSN = new ObjectParameter("UserSN", typeof(long));
                 * ObjectParameter gUID = new ObjectParameter("GUID", typeof(string));
                 * ObjectParameter hashPhone = new ObjectParameter("HashPhone", typeof(string));
                 * ObjectParameter deviceID = new ObjectParameter("DeviceID", typeof(string));
                 * ObjectParameter pushKey = new ObjectParameter("PushKey", typeof(string));
                 * ObjectParameter createDate = new ObjectParameter("CreateDate", typeof(DateTime));
                 * ObjectParameter updateDate = new ObjectParameter("UpdateDate", typeof(DateTime));
                 *
                 * // User SN 정보 조회
                 * entity.UserGetInfoByToken(value.token, userSN, gUID, hashPhone, deviceID, pushKey, createDate, updateDate);
                 */

                returnValue.error   = 0;
                returnValue.message = "ok";

                string guid   = strGUID;
                long   usersn = (long)userSN.Value;
                returnValue.data = new
                {
                    usersn,
                    guid
                };
            }
            catch (Exception ex)
            {
                entity.ErrorLogCreate(HttpRequestMessageHelper.GetClientIpAddress(Request), Request.RequestUri.AbsoluteUri, ex.Source, ex.TargetSite.Name, ex.Message, ex.StackTrace, JsonConvert.SerializeObject(value));;
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }

            return(returnValue);
        }