public JsonResult Create(Category category)
        {
            if (ModelState.IsValid)
            {
                if (category.ParentId.HasValue)
                {
                    var getCategory = categoryRepo.FindById(category.ParentId.Value);
                    category.ParentName = getCategory.Name;
                }

                category.CreatedBy = Request.Cookies["USER"].Value;
                category.CreationDate = DateTime.Now;
                categoryRepo.Insert(category);
                categoryRepo.Save();

                return Json(new { success = true });
            }
            return Json(category, JsonRequestBehavior.AllowGet);
        }
 public ActionResult Create()
 {
     var category = new Category();
     return PartialView("Create", category);
 }
 public ActionResult Edit(Category category)
 {
     if (ModelState.IsValid)
     {
         if (category.ParentId.HasValue)
         {
             var getCategory = categoryRepo.FindById(category.ParentId.Value);
             category.ParentName = getCategory.Name;
         }
         categoryRepo.Update(category);
         categoryRepo.Save();
         return Json(new { success = true });
     }
     return PartialView("Edit", category);
 }
 public void Delete(Category entity)
 {
     context.Categories.Remove(entity);
 }
 public void Update(Category entity)
 {
     context.Entry(entity).State = System.Data.Entity.EntityState.Modified;
 }
 public void Insert(Category entity)
 {
     context.Categories.Add(entity);
 }