示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ONG oNG = db.ONGs.Find(id);

            db.ONGs.Remove(oNG);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "ID,Nome,CPF")] ONG oNG)
 {
     if (ModelState.IsValid)
     {
         db.Entry(oNG).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(oNG));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "ID,Nome,CPF")] ONG oNG)
        {
            if (ModelState.IsValid)
            {
                db.ONGs.Add(oNG);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(oNG));
        }
示例#4
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ONG oNG = db.ONGs.Find(id);

            if (oNG == null)
            {
                return(HttpNotFound());
            }
            return(View(oNG));
        }
 public void Add(ONG ongs)
 {
     _ongRepositories.Add(ongs);
 }
 public IActionResult Post([FromBody] ONG ongs)
 {
     _ongServices.Add(ongs);
     return(Ok(ongs));
 }
示例#7
0
 public void Update(ONG ongs)
 {
     throw new NotImplementedException();
 }
示例#8
0
        public void Add(ONG ongs)
        {
            var sql = "Insert into ongs (Id, Name, Email, Whatsapp, City, UF ) values(@Id, @Name, @Email, @Whatsapp, @City, @UF)";

            _sqlConnection.Query <ONG>(sql, new { ongs.Id, ongs.Name, ongs.Email, ongs.Whatsapp, ongs.City, ongs.UF });
        }