示例#1
0
        public IHttpActionResult PutmemberList(int id, raceListModel.memberList memberList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != memberList.Id)
            {
                return(BadRequest());
            }

            db.Entry(memberList).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!memberListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public IHttpActionResult GetmemberList(int id)
        {
            raceListModel.memberList memberList = db.memberLists.Find(id);
            if (memberList == null)
            {
                return(NotFound());
            }

            return(Ok(memberList));
        }
示例#3
0
        public IHttpActionResult PostmemberList(raceListModel.memberList memberList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.memberLists.Add(memberList);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = memberList.Id }, memberList));
        }
示例#4
0
        public IHttpActionResult DeletememberList(int id)
        {
            raceListModel.memberList memberList = db.memberLists.Find(id);
            if (memberList == null)
            {
                return(NotFound());
            }

            db.memberLists.Remove(memberList);
            db.SaveChanges();

            return(Ok(memberList));
        }