public IActionResult Post([FromBody] Employee model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _context.Employees.Add(model);
         }
         _context.SaveChanges();
         return(Created("", null));
     }
     catch (Exception)
     {
         _logger.LogError("Failed to execute POST");
         return(BadRequest());
     }
 }
예제 #2
0
 public void Insert(TEntity entity)
 {
     DbSet.Add(entity);
     _context.SaveChanges();
 }