Ejemplo n.º 1
0
        public IHttpActionResult PutMuralModel(int id, MuralModel muralModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != muralModel.Id)
            {
                return(BadRequest());
            }

            db.Entry(muralModel).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MuralModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            MuralModel muralModel = db.MuralModels.Find(id);

            db.MuralModels.Remove(muralModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Escola_Id,Conteudo,Curtidas")] MuralModel muralModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(muralModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(muralModel));
 }
Ejemplo n.º 4
0
        public IHttpActionResult GetEscolaMural(int id)
        {
            MuralModel muralModel = dbset.Find(id);

            if (muralModel == null)
            {
                return(NotFound());
            }

            return(Ok(muralModel));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Id,Escola_Id,Conteudo,Curtidas")] MuralModel muralModel)
        {
            if (ModelState.IsValid)
            {
                dbset.Add(muralModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(muralModel));
        }
Ejemplo n.º 6
0
        public IHttpActionResult PostMuralModel(MuralModel muralModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            dbset.Add(muralModel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = muralModel.Id }, muralModel));
        }
Ejemplo n.º 7
0
        // GET: Mural/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MuralModel muralModel = db.MuralModels.Find(id);

            if (muralModel == null)
            {
                return(HttpNotFound());
            }
            return(View(muralModel));
        }
Ejemplo n.º 8
0
        public IHttpActionResult DeleteMuralModel(int id)
        {
            MuralModel muralModel = dbset.Find(id);

            if (muralModel == null)
            {
                return(NotFound());
            }

            dbset.Remove(muralModel);
            db.SaveChanges();

            return(Ok(muralModel));
        }