예제 #1
0
        public JsonResult Deletar(int id)
        {
            tbl_Casa tbl_Casa = db.tbl_Casa.Find(id);

            db.tbl_Casa.Remove(tbl_Casa);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
 public JsonResult Editar(tbl_Casa casa)
 {
     if (db.tbl_Casa.Any(x => x.Casa == casa.Casa && x.Id_Rua == casa.Id_Rua))
     {
         return(Json(false, JsonRequestBehavior.AllowGet));
     }
     db.Entry(casa).State = EntityState.Modified;
     db.SaveChanges();
     return(Json(true, JsonRequestBehavior.AllowGet));
 }
예제 #3
0
        public JsonResult Salvar(tbl_Casa casa)
        {
            if (db.tbl_Casa.Any(x => x.Casa == casa.Casa && x.Id_Rua == casa.Id_Rua))
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }

            db.Configuration.ValidateOnSaveEnabled = false;
            db.tbl_Casa.Add(casa);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }