public IHttpActionResult Postsupplierinfo(supplierinfo supplierinfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.supplierinfoes.Add(supplierinfo); try { db.SaveChanges(); } catch (DbUpdateException) { if (supplierinfoExists(supplierinfo.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = supplierinfo.Id }, supplierinfo)); }
public IHttpActionResult Putsupplierinfo(int id, supplierinfo supplierinfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != supplierinfo.Id) { return(BadRequest()); } db.Entry(supplierinfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!supplierinfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getsupplierinfo(string suppEmail, string password) { supplierinfo supp = db.supplierinfoes.Where(sup => sup.suppEmail.Equals(suppEmail) && sup.password.Equals(password)).FirstOrDefault(); if (suppEmail == null && password == null) { return(null); } else { return(Ok(supp)); } }
public IHttpActionResult Deletesupplierinfo(int id) { supplierinfo supplierinfo = db.supplierinfoes.Find(id); if (supplierinfo == null) { return(NotFound()); } db.supplierinfoes.Remove(supplierinfo); db.SaveChanges(); return(Ok(supplierinfo)); }