static void Main(string[] args) { var repositoryBL = new BL.Repository(); repositoryBL.Setup(); var workerBL = new BL.Worker(); Console.WriteLine("Adding new worker."); var newWorker = workerBL.AddWorker("My new worker " + DateTime.Now.ToShortTimeString()); Console.WriteLine(string.Format("New Worker id={0}, name={1}.", newWorker.ID, newWorker.Name)); Console.WriteLine("Getting the newly created worker."); var worker = workerBL.Get(newWorker.ID); Console.WriteLine("The worker's name={0}.", worker.Name); Console.WriteLine("Getting all workers."); var workerList = workerBL.GetAll(); foreach (var w in workerList) { Console.WriteLine(string.Format( "ID:{0},Name:{1}", w.ID, w.Name)); } Console.WriteLine("Updating the newly created worker."); worker.Name = "New worker [" + DateTime.Now.ToShortTimeString() + "]"; var updatedWorker = workerBL.Update( worker ); Console.WriteLine("Worker updated with name = " + worker.Name + " resulted in " + updatedWorker.Name); Console.WriteLine("Deleting the node again."); workerBL.Delete(worker.ID); workerList = workerBL.GetAll(); foreach (var w in workerList) { Console.WriteLine(string.Format("ID:{0},Name:{1}", w.ID, w.Name)); } ManipulateChunk(workerList.First()); Console.WriteLine(); Console.Write("Press any key..."); Console.ReadKey(); }
public ActionResult Index() { ViewBag.Message = "Workers work."; var bl = new BL.Worker(); var lst = bl.GetAll(); var model = new Models.WorkersModel(); model.WorkerList = lst.Select(x => Models.WorkerModel.Create(x.ID, x.Name)).ToList(); return View(model); }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { var workerBL = new BL.Worker(); var workers = workerBL.GetAll(); DataContext = workers; }