Пример #1
0
        public IHttpActionResult PutReservations(string id, Reservations reservations)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,TimeFrom,TimeTo,Status,Done,Version,CreatedAt,UpdatedAt,Deleted")] Reservations reservations)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reservations).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reservations));
 }