private void addDevSkill() { if (cmbDevSkillCart.SelectedIndex > -1) { if (rdbExpertise.SelectedIndex > -1) { AppliedSkills skill = new AppliedSkills(); var selected = Convert.ToInt32(cmbDevSkillCart.SelectedValue); skill.SkillId = easyContext.SkillsSetups.Where(a => a.Id == selected).Select(a => a.Id).FirstOrDefault(); skill.SkillName = easyContext.SkillsSetups.Where(a => a.Id == selected).Select(a => a.Details).FirstOrDefault(); skill.Rating = Convert.ToInt32(rdbExpertise.SelectedValue); DevSkillsApplied.Add(skill); ShowMessage("Thank you! We've added " + skill.SkillName + " to your expertise. Continue adding all the skills", WarningType.Success); loadSkills(); } else { ShowMessage("Please select skill expertise", WarningType.Danger); } } else { ShowMessage("Wonderful, You have added all skills to your expertise", WarningType.Info); } grdDevSkills.DataSource = null; grdDevSkills.DataBind(); grdDevSkills.DataSource = DevSkillsApplied.OrderByDescending(a => a.SkillName).ToList(); grdDevSkills.DataBind(); }
protected void grdDevSkills_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName != "SelectSkill") { return; } int id = Convert.ToInt32(e.CommandArgument); AppliedSkills applied = DevSkillsApplied.Where(a => a.SkillId == id).FirstOrDefault(); DevSkillsApplied.Remove(applied); loadSkills(); }
private List <AppliedSkills> loadDevSkillsApplied(int id) { List <AppliedSkills> appliedSkills = new List <AppliedSkills>(); var skills = easyContext.DevSkills.Where(a => a.DevId == id).ToList(); foreach (var item in skills) { AppliedSkills skill = new AppliedSkills(); skill.Rating = Convert.ToInt32(item.Rating); skill.SkillId = item.SkillId; skill.SkillName = item.SkillsSetup.Details; appliedSkills.Add(skill); } return(appliedSkills); }