예제 #1
0
 public IActionResult Put([FromServices] KitWebsDbContext context, [FromBody] KitNet kitNet)
 {
     context.Entry <KitNet>(kitNet).State =
         Microsoft.EntityFrameworkCore.EntityState.Modified;
     context.SaveChanges();
     return(Ok(new { message = "Alterado com sucesso" }));
 }
예제 #2
0
        public IActionResult Delete([FromServices] KitWebsDbContext context, int id)
        {
            var kitNet = context.KitNets.First(x => x.KitNetId == id);

            context.Entry <KitNet>(kitNet).State =
                Microsoft.EntityFrameworkCore.EntityState.Deleted;
            context.SaveChanges();
            return(Ok(new { message = "Excluido com sucesso" }));
        }