public JsonResult getcategories()
 {
     using (SkillsEntities dc = new SkillsEntities())
     {
         return(new JsonResult {
             Data = dc.Categories.ToList(), JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
 }
        public JsonResult savedata(int[] categoryIds)
        {
            //for make the application simple I am just sending back the selected categories from here
            // but you can do additional work here with categoryIds parameter
            List <Category> list = new List <Category>();

            if (categoryIds != null)
            {
                using (SkillsEntities dc = new SkillsEntities())
                {
                    list = dc.Categories.Where(a => categoryIds.Contains(a.CategoryID)).ToList();
                }

                // do your additional work here
            }
            return(new JsonResult {
                Data = list
            });
        }