Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AreaLazer areaLazer = db.AreaLazer.Find(id);

            db.AreaLazer.Remove(areaLazer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "Areaid,NomeArea,descricao,Regras,ApeId")] AreaLazer areaLazer)
        {
            if (ModelState.IsValid)
            {
                db.AreaLazer.Add(areaLazer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(areaLazer));
        }
Пример #3
0
        // GET: AreaLazer/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AreaLazer areaLazer = db.AreaLazer.Find(id);

            if (areaLazer == null)
            {
                return(HttpNotFound());
            }
            return(View(areaLazer));
        }
Пример #4
0
        public ActionResult Edit([Bind(Include = "Areaid,NomeArea,descricao,,Regras,ApeId")] AreaLazer areaLazer)
        {
            if (ModelState.IsValid)
            {
                db.Entry(areaLazer).State = EntityState.Modified;

                if (db.SaveChanges() > 0)
                {
                    ViewBag.Success = "Area Alterada com sucesso";
                }
                // return RedirectToAction("Index");
            }
            return(View(areaLazer));
        }
Пример #5
0
        public ActionResult SalvaArea(string nomearea, string descricao, string regras)
        {
            Sindico usuario = AdminLar.Repositories.Funcoes.GetUsuario();

            if (usuario != null)
            {
                AreaLazer area = new AreaLazer();

                area.NomeArea  = nomearea;
                area.descricao = descricao;
                area.Regras    = regras;
                area.ApeId     = usuario.ApeId;

                db.AreaLazer.Add(area);

                if (db.SaveChanges() > 0)
                {
                    return(Json(true));
                }
            }


            return(Json(false));
        }