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()); } }
public void Insert(TEntity entity) { DbSet.Add(entity); _context.SaveChanges(); }