Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Programist ls1 = new Programist("Паша", 1);
            Programist ls2 = new Programist("вика", 3);
            Programist ls3 = new Programist("Семен", 2);

            ls1.Print(); ls2.Print(); ls3.Print();

            Console.WriteLine();
            ls1.Delete += new Doing(ls1.Delet);
            ls2.Delete += new Doing(ls1.Myt);
            ls1.Del();
            ls1.Mytac();

            ls2.Mytaciya += new Doing(ls2.Myt);
            ls2.Del();
            Console.WriteLine();
            ls1.Print(); ls2.Print(); ls3.Print();

            //string str = "fdgvfd,fdf,";
            //Console.WriteLine(Programist.AddToch(str));
            //Console.WriteLine(Programist.Zadanie2(str));
            //Console.WriteLine(Programist.Zaglavnaya(str));

            string str = "Лабораторная работа №9, по ООП";

            Programist.Upgrade(str);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Name,Surname,Email")] Programist programist)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(programist);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(programist));
        }
Ejemplo n.º 3
0
        public static void Initialize(ManagerContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Programists.Any())
            {
                return;   // DB has been seeded
            }

            var programmers = new Programist[] {
                new Programist {
                    Id = 1, Name = "Egor", Surname = "Ivanov", Email = "*****@*****.**"
                },
                new Programist {
                    Id = 2, Name = "Marina", Surname = "Lozova", Email = "*****@*****.**"
                },
                new Programist {
                    Id = 3, Name = "Svitlana", Surname = "Sviridova", Email = "*****@*****.**"
                },
                new Programist {
                    Id = 4, Name = "Maksum", Surname = "Pochatkin", Email = "*****@*****.**"
                }
            };

            foreach (Programist s in programmers)
            {
                context.Programists.Add(s);
            }
            context.SaveChanges();

            var projects = new Proekt[]
            {
                new Proekt {
                    Id = 1, ProjectName = "Medithin", NumberOfWorkers = 3
                },
                new Proekt {
                    Id = 2, ProjectName = "Business analises", NumberOfWorkers = 2
                },
                new Proekt {
                    Id = 4, ProjectName = "Tutorial", NumberOfWorkers = 1
                },
                new Proekt {
                    Id = 3, ProjectName = "Web-site creator", NumberOfWorkers = 3
                }
            };

            foreach (Proekt i in projects)
            {
                context.Proekts.Add(i);
            }
            context.SaveChanges();

            var findWorkers = new Manager[]
            {
                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Medithin").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Lozova").Id
                },
                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Medithin").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Sviridova").Id
                },
                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Medithin").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Ivanov").Id
                },

                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Business analises").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Pochatkin").Id
                },
                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Business analises").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Ivanov").Id
                },

                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Tutorial").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Lozova").Id
                },

                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Web-site creator").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Sviridova").Id
                },
                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Web-site creator").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Lozova").Id
                },
                new Manager {
                    ProektId     = projects.Single(i => i.ProjectName == "Web-site creator").Id,
                    ProgramistId = programmers.Single(p => p.Surname == "Pochatkin").Id
                }
            };

            foreach (Manager mg in findWorkers)
            {
                context.Managers.Add(mg);
            }
            context.SaveChanges();
        }