public Subject GetSubject() { TypeSubject typeSubject = (TypeSubject)comboBSubject.SelectedIndex; Subject subject = new Subject(typeSubject); return(subject); }
public IHttpActionResult PutNota(TypeSubject id, Nota nota) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nota.Subject) { return(BadRequest()); } db.Entry(nota).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NotaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(TypeSubject id) { Nota nota = db.Notas.Find(id); db.Notas.Remove(nota); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult GetNota(TypeSubject id) { Nota nota = db.Notas.Find(id); if (nota == null) { return(NotFound()); } return(Ok(nota)); }
public IHttpActionResult DeleteNota(TypeSubject id) { Nota nota = db.Notas.Find(id); if (nota == null) { return(NotFound()); } db.Notas.Remove(nota); db.SaveChanges(); return(Ok(nota)); }
// GET: Notas/Delete/5 public ActionResult Delete(TypeSubject id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Nota nota = db.Notas.Find(id); if (nota == null) { return(HttpNotFound()); } return(View(nota)); }
private bool NotaExists(TypeSubject id) { return(db.Notas.Count(e => e.Subject == id) > 0); }
public Subject(TypeSubject typeSubject) { this.typeSubject = typeSubject; }