Ejemplo n.º 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 Create([Bind(Include = "Id,Name,TimeFrom,TimeTo,Status,Done,Version,CreatedAt,UpdatedAt,Deleted")] Reservations reservations)
        {
            if (ModelState.IsValid)
            {
                db.Reservations.Add(reservations);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(reservations));
        }