Ejemplo n.º 1
0
        public ActionResult Index(FormCollection form, SkillSearchModel skillSearchModel)
        {
            var list = from skill in _dbContext.Skills.ToList()
                       join category in _dbContext.Categories.ToList()
                           on skill.CategoryId equals category.Id
                       where (
                            (!String.IsNullOrEmpty(skillSearchModel.SkillName) ?
                                skill.SkillName.Contains(skillSearchModel.SkillName,
                                    StringComparison.OrdinalIgnoreCase) : true
                            ) &&
                            ((skillSearchModel.Id != default(int)) ?
                                skillSearchModel.Id == skill.Id : true
                            )
                       )
                       select new Skill
                       {
                           Id = skill.Id,
                           SkillName = skill.SkillName,
                           SkillDescription = skill.SkillDescription,
                           SkillStatus = skill.SkillStatus,
                           CreateDate = skill.CreateDate,
                           UpdateDate = skill.UpdateDate,
                           Category = category
                       };

            skillSearchModel.Skills = list;
            skillSearchModel.Queryables = GetQueryables();

            return View(skillSearchModel);
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            SkillSearchModel skillSearchModel = new SkillSearchModel();

            var list = from skill in _dbContext.Skills.ToList()
                       join category in _dbContext.Categories.ToList()
                           on skill.CategoryId equals category.Id
                       select new Skill
                       {
                           Id = skill.Id,
                           SkillName = skill.SkillName,
                           SkillDescription = skill.SkillDescription,
                           SkillStatus = skill.SkillStatus,
                           CreateDate = skill.CreateDate,
                           UpdateDate = skill.UpdateDate,
                           Category = category
                       };

            skillSearchModel.Skills = list;
            skillSearchModel.Queryables = GetQueryables();
            skillSearchModel.Id = default(int);

            return View(skillSearchModel);
        }