public async Task <ActionResult> Create(Item item, int CategoryId) { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var currentUser = await _userManager.FindByIdAsync(userId); item.User = currentUser; _db.Items.Add(item); if (CategoryId != 0) { _db.CategoryItem.Add(new CategoryItem() { CategoryId = CategoryId, ItemId = item.ItemId }); } _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Category category) { _db.Categories.Add(category); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Class2 item) { _db.Class2plural.Add(item); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Class1 class1) { _db.Class1pl.Add(class1); _db.SaveChanges(); return(RedirectToAction("Index")); }