Exemplo n.º 1
0
 public IActionResult Post([FromBody] Cuddly Cuddly)
 {
     if (Cuddly == null)
     {
         return(BadRequest());
     }
     return(Ok(_Cuddly.Create(Cuddly)));
 }
 public Cuddly Create(Cuddly Cuddly)
 {
     try
     {
         _dataset.Add(Cuddly);
         _context.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
     return(Cuddly);
 }
 public Cuddly UpDate(Cuddly Cuddly)
 {
     if (Cuddly.CuddlyId == null)
     {
         return(null);
     }
     try
     {
         _dataset.Update(Cuddly);
         _context.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
     return(Cuddly);
 }