コード例 #1
0
        public HttpResponseMessage InsertNewUserLog(NewUserLogInsertRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            try
            {
                bool isSuccess = LogService.CreateNewLog(model);

                if (isSuccess)
                {
                    var response = new ItemResponse <bool> {
                        Item = isSuccess
                    };

                    return(Request.CreateResponse(HttpStatusCode.OK, response));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Unable to Process Request."));
                }
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message));
            }
        }