static void Main(string[] args) { EmplDbContext db = new EmplDbContext(); db.Database.EnsureDeleted(); db.Database.EnsureCreated(); //Department dep = new Department { Name = "Test" }; //db.Employees.Add(new Employee { Name = "Pesho"}); //db.Departments.Add(dep); db.SaveChanges(); }
public RedirectResult AddNewWorker(Worker worker) { db.Workers.Add(worker); db.SaveChanges(); return(RedirectPermanent("/Home/Index")); }