예제 #1
0
        public IHttpActionResult PutIssue(int id, Issue issue)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != issue.issueID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "customerID,navn,passord")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
        public async Task <ActionResult> Edit([Bind(Include = "bookingID,customerID,roomtype,checkinDate,checkoutDate,room")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                db.Entry(booking).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.customerID = new SelectList(db.Customer, "customerID", "navn", booking.customerID);
            ViewBag.room       = new SelectList(db.Room, "roomID", "roomID", booking.room);
            return(View(booking));
        }