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

            db.ONGs.Remove(oNG);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #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));
 }
Beispiel #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));
        }
Beispiel #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));
 }
Beispiel #7
0
 public void Update(ONG ongs)
 {
     throw new NotImplementedException();
 }
Beispiel #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 });
        }