public int Edit(Doquantrong dqt) { Doquantrong dqts = tb.Doquantrong.Find(dqt.Iddqt); dqts.Tendqt = dqt.Tendqt; try { tb.Entry(dqts).State = EntityState.Modified; tb.SaveChanges(); return(1); } catch { throw; } }
public int Create([FromBody] Doquantrong dqt) { dqt.Iddqt = Auto_id(); tb.Doquantrong.Add(dqt); try { if (ModelState.IsValid) { tb.SaveChanges(); } return(1); } catch (DbUpdateException) { throw; } }
public int Delete(string id) { try { Doquantrong dqt = tb.Doquantrong.Find(id); if (dqt != null) { tb.Doquantrong.Remove(dqt); tb.SaveChanges(); return(1); } else { return(0); } } catch { throw; } }