コード例 #1
0
 // POST: odata/WebUsers
 public async Task<IHttpActionResult> Post( WebUser webUser ) {
     try {
         webUser.LoginTime = DateTime.Now;
         if ( !ModelState.IsValid ) {
             throw new Exception( "Not Valid: " + webUser.toString() );
         }
         db.WebUserSet.Add( webUser );
         await db.SaveChangesAsync();
         return Created( webUser );
     } catch ( Exception e ) {
         Log.Error( e.Message );
         return BadRequest( ModelState );
     }
 }
コード例 #2
0
 public async Task<IHttpActionResult> Post( WebUser webUser ) {
     try {
         //webUser.LoginTime = DateTime.Now;
         if ( !ModelState.IsValid ) {
             throw new Exception( "Not Valid: ");
         }
         //db.WebUserSet.Add( webUser );
         await db.SaveChangesAsync();
         return Created( new WebUser() {FirstName="Test", LastName="Test", Email="Test" } );
     } catch ( Exception e ) {
         Log.Error( e.Message );
         return BadRequest( ModelState );
     }
 }
コード例 #3
0
 public async Task<IHttpActionResult> Post(WebUser webUser) {
     Log.Debug( webUser.toString() );
     await db.SaveChangesAsync();
     return BadRequest( ModelState );
 }