示例#1
0
        public async Task <IActionResult> PutChurrasco(long id, Churrasco churrasco)
        {
            if (id != churrasco.Id)
            {
                return(BadRequest());
            }

            _context.Entry(churrasco).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChurrascoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "ID,Description,Observation,Date,SpentDrink,SpentFood")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Events", new { id = @event.ID }));
     }
     return(View(@event));
 }
 public ActionResult Edit([Bind(Include = "ID,Name")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(person));
 }
 public ActionResult Edit([Bind(Include = "ID,EventID,PersonID,Paid,Drink,Amount,Observation")] Enrollment enrollment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(enrollment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Events", new { id = enrollment.EventID }));
     }
     ViewBag.EventList  = new SelectList(db.Events, "ID", "Description", enrollment.EventID);
     ViewBag.PersonList = new SelectList(db.Persons, "ID", "Name", enrollment.PersonID);
     return(View(enrollment));
 }