public ActionResult Create(Palestrante palestrante) { if (ModelState.IsValid) { db.Palestrantes.Add(palestrante); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(palestrante)); }
// PUT api/Palestras/5 public HttpResponseMessage PutPalestra(int id, Palestra palestra) { if (ModelState.IsValid && id == palestra.Id) { db.Entry(palestra).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, palestra)); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }