Example #1
0
        public ActionResult Index()
        {
            var userSkills = GetUserSkills(User.Identity.GetUserId());
            var allSkills  = GetSkills(userSkills);
            var model      = new SkillModels
            {
                Skills = allSkills
            };

            return(View(model));
        }
Example #2
0
        // GET: Skill/Details/5
        public ActionResult Details(int id)
        {
            Skill       s   = skserv.GetById(id);
            SkillModels skm = new SkillModels

            {
                SkillName  = s.SkillName,
                SkillLevel = s.SkillLevel
            };

            return(View(skm));
        }
Example #3
0
        // GET: Skill/Edit/5
        public ActionResult Edit(int id)
        {
            Skill sl = skserv.GetById(id);

            SkillModels sm = new SkillModels();


            sm.SkillName  = sl.SkillName;
            sm.SkillLevel = sl.SkillLevel;


            return(View(sm));
        }
Example #4
0
 public ActionResult Delete(int id, SkillModels collection)
 {
     try
     {
         // TODO: Add delete logic here
         Skill s = skserv.getSkillById(id);
         //s.SkillId = collection.SkillId;
         skserv.deleteSkill(s);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Example #5
0
        public ActionResult Create(SkillModels s)
        {
            if (ModelState.IsValid)
            {
                Skill sk = new Skill
                {
                    SkillName  = s.SkillName,
                    SkillLevel = s.SkillLevel
                };

                skserv.createSkill(sk);
                skserv.Commit();
            }



            return(RedirectToAction("Index"));
        }
Example #6
0
        public ActionResult Edit(int id, SkillModels collection)
        {
            try
            {
                Skill s = skserv.getSkillById(id);
                //s.SkillId = collection.SkillId;
                s.SkillName  = collection.SkillName;
                s.SkillLevel = collection.SkillLevel;

                skserv.updateSkill(s);
                skserv.Commit();
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(RedirectToAction("Edit", "Skill"));
            }
        }
Example #7
0
        // GET: Skill
        public ActionResult Index()
        {
            List <SkillModels> sklist = new List <SkillModels>();

            if (ModelState.IsValid)
            {
                foreach (var item in skserv.getAllSkill())
                {
                    SkillModels SM = new SkillModels();

                    SM.SkillId    = item.SkillId;
                    SM.SkillName  = item.SkillName;
                    SM.SkillLevel = item.SkillLevel;


                    sklist.Add(SM);
                }

                return(View(sklist));
            }

            return(View(sklist));
        }