示例#1
0
        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();
        }
示例#2
0
 public RedirectResult AddNewWorker(Worker worker)
 {
     db.Workers.Add(worker);
     db.SaveChanges();
     return(RedirectPermanent("/Home/Index"));
 }