public async Task <IHttpActionResult> PutFakeAccountInfo(int id, FakeAccountInfo fakeAccountInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fakeAccountInfo.InfoId) { return(BadRequest()); } db.Entry(fakeAccountInfo).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FakeAccountInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetFakeAccountInfo(int id) { FakeAccountInfo fakeAccountInfo = await db.FakeAccountInfoes.FindAsync(id); if (fakeAccountInfo == null) { return(NotFound()); } return(Ok(fakeAccountInfo)); }
public async Task <IHttpActionResult> PostFakeAccountInfo(FakeAccountInfo fakeAccountInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.FakeAccountInfoes.Add(fakeAccountInfo); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = fakeAccountInfo.InfoId }, fakeAccountInfo)); }
public async Task <IHttpActionResult> DeleteFakeAccountInfo(int id) { FakeAccountInfo fakeAccountInfo = await db.FakeAccountInfoes.FindAsync(id); if (fakeAccountInfo == null) { return(NotFound()); } db.FakeAccountInfoes.Remove(fakeAccountInfo); await db.SaveChangesAsync(); return(Ok(fakeAccountInfo)); }