public ActionResult Create(Item item, int CategoryId)
 {
     _db.ItemsTable.Add(item);
     if (CategoryId != 0)
     {
         _db.CategoryItemJoinedTable.Add(new CategoryItem()
         {
             CategoryId = CategoryId, ItemId = item.ItemId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemple #2
0
 public ActionResult Create(Category category)
 {
     _db.CategoriesTable.Add(category);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }