Пример #1
0
 public ActionResult Edit(Auction auction)
 {
     if (ModelState.IsValid)
     {
         db.Entry(auction).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(auction));
 }
Пример #2
0
        // PUT api/Auctions/5
        public HttpResponseMessage PutAuction(long id, Auction auction)
        {
            if (ModelState.IsValid && id == auction.Id)
            {
                db.Entry(auction).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }