Beispiel #1
0
        public Categoria Put([FromBody] Categoria cat)
        {
            _context.Entry <Categoria>(cat).State = EntityState.Modified;
            _context.SaveChanges();

            return(cat);
        }
Beispiel #2
0
        public async Task <IActionResult> PutCat(Guid id, Cat cat)
        {
            if (id != cat.Id)
            {
                return(BadRequest());
            }

            _context.Entry(cat).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CatExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Breed breed)
 {
     if (ModelState.IsValid)
     {
         db.Entry(breed).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(breed));
 }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "Id,Name,BreedId")] Cat cat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BreedId = new SelectList(db.Breeds, "Id", "Name", cat.BreedId);
     return(View(cat));
 }
Beispiel #5
0
 public void Update(Produto p)
 {
     _context.Entry <Produto>(p).State = EntityState.Modified;
     _context.SaveChanges();
 }