コード例 #1
0
 public HttpResponseMessage Post(Artist a)
 {
     if (a == null)
     {
         return new HttpResponseMessage(HttpStatusCode.BadRequest);
     }
     dbContext.Artist.Add(a);
     dbContext.SaveChanges();
     return new HttpResponseMessage(HttpStatusCode.Created);
 }
コード例 #2
0
        public HttpResponseMessage Put(int id, Artist a)
        {
            var artist = dbContext.Artist.Find(a);

            if (artist == null)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }

            artist.Name = a.Name;
            dbContext.SaveChanges();
            return new HttpResponseMessage(HttpStatusCode.OK);
        }