Example #1
0
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            CarSalesman steve = new CarSalesman("Steve", "Rogers");

            // Console.WriteLine(steve.FullName);
            steve.Sell();


            RetailSalesPerson jon = new RetailSalesPerson("jon", "bon");

            jon.Sell();

            //Dynamic polymorphism
            List <Salesman> salelist = new List <Salesman>()
            {
                new CarSalesman("bon", "Rogers"), new RetailSalesPerson("kon", "saa")
            };

            WebDeveloper Roan = new WebDeveloper("java");

            Roan.Code();
            Roan.Code("javascript", "thirsdal");
            Roan.Develop();
            foreach (var item in salelist)
            {
                ShowMeSell(item);
            }
Example #2
0
        public IHttpActionResult CreateWebDeveloper(WebDeveloperViewModel viewModel)
        {
            //Check model validity
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //Create the new web developer and assign the content of the view model
            var wd = new WebDeveloper();

            using (var context = new Context())
            {
                wd.Address           = viewModel.Address;
                wd.Comments          = viewModel.Comments;
                wd.ContactPhone      = viewModel.ContactPhone;
                wd.DayOfBirth        = viewModel.DayOfBirth;
                wd.Email             = viewModel.Email;
                wd.FirstName         = viewModel.FirstName;
                wd.LastName          = viewModel.LastName;
                wd.YearsOfExperience = viewModel.YearsOfExperience;

                //If a web technology has been selected I add it to the web technologies of the new webdeveloper
                wd.WebTechnologies = new List <WebTechnology>();
                foreach (var wt in viewModel.WebTechnologies)
                {
                    if (wt.IsSelected)
                    {
                        var wtInDB = context.WebTechnology.Single(x => x.Id == wt.Id);
                        wd.WebTechnologies.Add(wtInDB);
                    }
                }

                //If a stack has been selected I add it to the stacks of the new webdeveloper
                wd.Stacks = new List <Stack>();
                foreach (var stack in viewModel.Stacks)
                {
                    if (stack.IsSelected)
                    {
                        var stackInDB = context.Stack.Single(x => x.Id == stack.Id);
                        wd.Stacks.Add(stackInDB);
                    }
                }

                context.WebDeveloper.Add(wd);

                context.SaveChanges();
            }

            //Since the two navigation are not deserialized from the datatble I null them, thery are not necessary
            wd.WebTechnologies = null;
            wd.Stacks          = null;
            return(Created(new Uri(Request.RequestUri + "/" + wd.Id), wd));
        }
        public void ApplicantMandatoryTestWebDeveloper()
        {
            Console.WriteLine(string.Format("{0} Applicant Mandatory Test", WebDeveloper.Name));
            PropertiesCollection.OpenBrowser(WebDeveloper.Url);
            WebDeveloper page = new WebDeveloper();
            if (page.ApplicantMandatoryTest())
            {
            };

            foreach (TestResultInPage result in page.TestResultInPages) Console.WriteLine(result.Report());
            PropertiesCollection.driver.Quit();
        }
Example #4
0
        public static void Main(string[] args)
        {
            Director teamLeader = new TeamLeader();

            Programmer webDeveloper = new WebDeveloper();

            Application webApplication = teamLeader.CreateApplication(webDeveloper);

            Console.WriteLine("Created Web Application:");
            Console.WriteLine(webApplication.GetApplicationInformation());

            Programmer mobileDeveloper = new MobileDeveloper();

            Application mobileApplication = teamLeader.CreateApplication(mobileDeveloper);

            Console.WriteLine("\n\nCreated Mobile Application:");
            Console.WriteLine(mobileApplication.GetApplicationInformation());
        }