// GET: /SubskillsinBk2/Details/5
        public ActionResult changes(int bk2id, int subskillid)
        {
            SubskillsinBk2 subskilbk2 = new SubskillsinBk2();

            subskilbk2.BkLevel2ID  = bk2id;
            subskilbk2.SubskillsID = subskillid;
            List <SubskillsinBk2> lst_subskill_bk2 = new List <SubskillsinBk2>();

            lst_subskill_bk2 = db.SubskillsinBk2.Where(m => m.SubskillsID == subskillid && m.BkLevel2ID == bk2id).ToList();
            if (lst_subskill_bk2.Count() == 0)
            {
                db.SubskillsinBk2.Add(subskilbk2);
            }
            else
            {
                foreach (var item in lst_subskill_bk2)
                {
                    db.SubskillsinBk2.Remove(item);
                }
            }

            db.SaveChanges();

            return(RedirectToAction("Index", new { @bk2id = bk2id }));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SubskillsinBk2 subskillsinbk2 = db.SubskillsinBk2.Find(id);

            db.SubskillsinBk2.Remove(subskillsinbk2);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "SubskillsBk2ID,SubskillsID,BkLevel2ID")] SubskillsinBk2 subskillsinbk2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subskillsinbk2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BkLevel2ID     = new SelectList(db.BKLevel2, "BKLevel2ID", "Name", subskillsinbk2.BkLevel2ID);
     ViewBag.SubskillsBk2ID = new SelectList(db.SubSkills, "SubskillsID", "Name", subskillsinbk2.SubskillsBk2ID);
     ViewBag.SubskillsID    = new SelectList(db.SubSkills, "SubskillsID", "Name", subskillsinbk2.SubskillsID);
     return(View(subskillsinbk2));
 }
        // GET: /SubskillsinBk2/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubskillsinBk2 subskillsinbk2 = db.SubskillsinBk2.Find(id);

            if (subskillsinbk2 == null)
            {
                return(HttpNotFound());
            }
            return(View(subskillsinbk2));
        }
        // GET: /SubskillsinBk2/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubskillsinBk2 subskillsinbk2 = db.SubskillsinBk2.Find(id);

            if (subskillsinbk2 == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BkLevel2ID     = new SelectList(db.BKLevel2, "BKLevel2ID", "Name", subskillsinbk2.BkLevel2ID);
            ViewBag.SubskillsBk2ID = new SelectList(db.SubSkills, "SubskillsID", "Name", subskillsinbk2.SubskillsBk2ID);
            ViewBag.SubskillsID    = new SelectList(db.SubSkills, "SubskillsID", "Name", subskillsinbk2.SubskillsID);
            return(View(subskillsinbk2));
        }