public async Task <IHttpActionResult> Remove([FromBody] QItem p) { var r = new ResultBase(); var id = p.id; using (db0 = new Bpple_DBEntities()) { try { var md = await db0.Member.FindAsync(id); var entry = db0.Entry <Member>(md); entry.State = EntityState.Deleted; await db0.SaveChangesAsync(); r.state = 0; } catch (Exception ex) { r.state = 999; r.message = ex.Message; } return(Ok(r)); } }
public async Task <IHttpActionResult> Modify([FromBody] PutData p) { var r = new ResultBase(); var md = p.md; var id = p.id; using (db0 = new Bpple_DBEntities()) { try { #region set value db0.Entry(md).State = EntityState.Modified; await db0.SaveChangesAsync(); #endregion r.state = 0; } catch (Exception ex) { r.state = 999; r.message = ex.Message; } return(Ok(r)); } }