Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
            }
        }
Пример #4
0
        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));
        }