public ActionResult Create(EmployeeViewModel model)
        {
            model.Employee.Gender            = _repository.GetOptionById <Gender, DenormalizedReference>(model.Employee.Gender.DenormalizedId);
            model.Employee.ProgrammingRating = _repository.GetOptionById <ProgrammingRating, DenormalizedReference>(model.Employee.ProgrammingRating.DenormalizedId);

            model.Employee.Skills = model.LstSkill.Where(c => c.IsSelected == true).Select(c => c.DenormalizedReference).ToList();

            _repository.Insert <Employee>(model.Employee);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Create(ClientViewModel model)
        {
            if (ModelState.IsValid)
            {
                _repository.Insert <Client>(model.Client);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        public void ProcessClient(IMXEntity message)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("-----------------Processing now...-----------------");

            var client = message as Client;

            if (client != null)
            {
                var result = _bRepository.Insert <Client>(client);
                Console.WriteLine("New Client Created with Id : " + result);
            }

            Console.WriteLine("\n-----------------Processing Complete..-----------------");
            Console.ResetColor();
        }
Exemplo n.º 4
0
        public void SetMasterData()
        {
            //insert these flags before hand for now.
            List <FlagSetting> lstFlagSetting = new List <FlagSetting>()
            {
                new FlagSetting {
                    Name = "bUseElasticSearchEngine", Description = "enable product search on ElasticSearch engine", FlagValue = "false", IsPermanent = false
                },
                new FlagSetting {
                    Name = "bShowLoadTime", Description = "Show load timings. This is used for identifying the bottle necks", FlagValue = "true", IsPermanent = true
                },
            };

            _cRepository.Insert <FlagSetting>(lstFlagSetting);

            List <ProgrammingRating> lstProgrammingRating = new List <ProgrammingRating>()
            {
                new ProgrammingRating {
                    Name = "Expert", Code = "EX"
                },
                new ProgrammingRating {
                    Name = "Good", Code = "GD"
                },
                new ProgrammingRating {
                    Name = "Average", Code = "AVG"
                },
                new ProgrammingRating {
                    Name = "Beginner", Code = "B"
                },
                new ProgrammingRating {
                    Name = "Hopeless", Code = "HL"
                },
            };

            _bRepository.Insert <ProgrammingRating>(lstProgrammingRating);

            List <Gender> lstGender = new List <Gender>()
            {
                new Gender {
                    Name = "Male", Code = "M"
                },
                new Gender {
                    Name = "Female", Code = "F"
                },
            };

            _bRepository.Insert <Gender>(lstGender);

            List <Skill> lstSkill = new List <Skill>()
            {
                new Skill {
                    Name = "Ruby On Rails", Code = "RR"
                },
                new Skill {
                    Name = "Core Java", Code = "J"
                },
                new Skill {
                    Name = "Java EE", Code = "J"
                },
                new Skill {
                    Name = "Scala"
                },
                new Skill {
                    Name = "Play Framework"
                },
                new Skill {
                    Name = "Python"
                },
                new Skill {
                    Name = "ASP.Net MVC"
                },
            };

            _bRepository.Insert <Skill>(lstSkill);

            List <ClientType> lstClientType = new List <ClientType>()
            {
                new ClientType {
                    Name = "Information Technology-1"
                },
                new ClientType {
                    Name = "Information Technology-2"
                },
                new ClientType {
                    Name = "Information Technology-3"
                },
                new ClientType {
                    Name = "Information Technology-4"
                },
                new ClientType {
                    Name = "Energy Sector-1"
                },
                new ClientType {
                    Name = "Energy Sector-2"
                },
                new ClientType {
                    Name = "Energy Sector-3"
                },
            };

            _bRepository.Insert <ClientType>(lstClientType);

            List <Author> lstAuthor = new List <Author>()
            {
                new Author {
                    Name = "Paulo Coelho"
                },
                new Author {
                    Name = "Amit Kumar"
                },
                new Author {
                    Name = "David Schwartz"
                },
                new Author {
                    Name = "Max Payne"
                },
                new Author {
                    Name = "Michael Hartl"
                },
            };

            _pcRepository.Insert <Author>(lstAuthor);

            List <BookCategory> lstBookCategory = new List <BookCategory>()
            {
                new BookCategory {
                    Name = "Python"
                },
                new BookCategory {
                    Name = "Java"
                },
                new BookCategory {
                    Name = "Inspiration, Motivation"
                },
                new BookCategory {
                    Name = "Fiction"
                },
                new BookCategory {
                    Name = "Ruby On Rails"
                },
            };

            _pcRepository.Insert <BookCategory>(lstBookCategory);

            //Create a text index on Book collection, this required for free text searching actually.
            var collection = _pcRepository.DbContext.GetCollection <Book>("Book");

            if (!collection.IndexExistsByName("book_text"))
            {
                collection.CreateIndex(IndexKeys.Text("nm", "au.nm", "ct.nm"), IndexOptions.SetName("book_text").SetWeight("nm", 4).SetWeight("au.nm", 3));
            }
        }