Beispiel #1
0
        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));
        }
Beispiel #3
0
        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));
        }
Beispiel #6
0
        // 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);
 }
Beispiel #8
0
 public Subject(TypeSubject typeSubject)
 {
     this.typeSubject = typeSubject;
 }