public IHttpActionResult PutNHAXB(string id, NHAXB nHAXB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nHAXB.MaNXB) { return(BadRequest()); } db.Entry(nHAXB).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NHAXBExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostNHAXB(NHAXB nHAXB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NHAXBs.Add(nHAXB); try { db.SaveChanges(); } catch (DbUpdateException) { if (NHAXBExists(nHAXB.MaNXB)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nHAXB.MaNXB }, nHAXB)); }
public IHttpActionResult GetNHAXB(string id) { NHAXB nHAXB = db.NHAXBs.Find(id); if (nHAXB == null) { return(NotFound()); } return(Ok(nHAXB)); }
public int delNXB(string ma) { try { NHAXB s = linqToMySQL1.NHAXBs.Where(t => t.MANXB == ma).Select(t => t).FirstOrDefault(); linqToMySQL1.NHAXBs.DeleteOnSubmit(s); linqToMySQL1.SubmitChanges(); return(1); } catch { return(0); } }
public IHttpActionResult DeleteNHAXB(string id) { NHAXB nHAXB = db.NHAXBs.Find(id); if (nHAXB == null) { return(NotFound()); } db.NHAXBs.Remove(nHAXB); db.SaveChanges(); return(Ok(nHAXB)); }
public int upNXB(string ma, string ten, string dt, string dc) { try { NHAXB s = linqToMySQL1.NHAXBs.Where(t => t.MANXB == ma).Select(t => t).FirstOrDefault(); s.TENNXB = ten; s.DTNXB = dt; s.DCNXB = dc; linqToMySQL1.SubmitChanges(); return(1); } catch { return(0); } }
public int addNXB(string ma, string ten, string dt, string dc) { try { NHAXB s = new NHAXB(); s.MANXB = ma; s.TENNXB = ten; s.DTNXB = dt; s.DCNXB = dc; linqToMySQL1.NHAXBs.InsertOnSubmit(s); linqToMySQL1.SubmitChanges(); return(1); } catch { return(0); } }