public async Task <ActionResult <Atividade> > PutAtividade(int id, Atividade atividade) { if (id != atividade.Id) { return(BadRequest()); } _context.Entry(atividade).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AtividadeExists(id)) { return(NotFound()); } else { throw; } } return(await _context.Atividade.FindAsync(atividade.Id)); }
public async Task <IActionResult> PutResponsavel(int id, Responsavel responsavel) { if (id != responsavel.Id) { return(BadRequest()); } _context.Entry(responsavel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResponsavelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "PersonId,Name,DOB,Email,Phone")] Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Edit([Bind(Include = "AddressId,HouseNo,Line1,Line2,CountryId,CityId,PersonId")] Address address) { if (ModelState.IsValid) { db.Entry(address).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", "Person", new { id = address.PersonId })); } ViewBag.CityId = new SelectList(db.Cities, "CityId", "CityName", address.CityId); ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", address.CountryId); ViewBag.PersonId = new SelectList(db.People, "PersonId", "Name", address.PersonId); return(View(address)); }