public ActionResult Create(Category category)
 {
     ApplicationUserManager userManager = HttpContext.GetOwinContext()
                                     .GetUserManager<ApplicationUserManager>();
     ApplicationUser user = userManager.FindByEmail(User.Identity.Name);
     category.UserId = user.Id;
     db.Categories.Add(category);
     db.SaveChanges();
     return RedirectToAction("Categories");
 }
 public ActionResult Edit(int? id)
 {
     string currentUserId = CurrentUserId();
     if (id == null)
         return HttpNotFound();
     Category category = new Category();
     category = db.Categories.FirstOrDefault(c => c.Id == id && c.UserId == currentUserId);
     if (category == null)
         return HttpNotFound();
     return View(category);
 }
        public ActionResult Edit(Category category)
        {
            Category newCategory = new Category();
            newCategory = db.Categories.Find(category.Id);
            newCategory.Text = category.Text;

            db.Entry(newCategory).State = EntityState.Modified;
            db.SaveChanges();
            return RedirectToAction("Categories");
        }