public async Task <bool> Create(MenuItemsModel menuItemsModel) { _context.Add(menuItemsModel); await _context.SaveChangesAsync(); return(true); }
public async Task <ContactModel> Create(ContactModel contactModel) { _context.Add(contactModel); await _context.SaveChangesAsync(); return(contactModel); }
public async Task <CategoryModel> Create(CategoryModel categoryModel) { _context.Add(categoryModel); await _context.SaveChangesAsync(); return(categoryModel); }
public async Task <ProductModel> Create(ProductModel productModel) { productModel.Created = DateTime.Now; _context.Add(productModel); await _context.SaveChangesAsync(); return(productModel); }
public async Task <IActionResult> Create([Bind("ID")] CartModel cartModel) { if (ModelState.IsValid) { _context.Add(cartModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cartModel)); }
public async Task <OrderModel> Create(CartModel cartModel, UserModel currentUser, string orderNotes) { OrderModel ordermodel = new OrderModel(); ordermodel.Cart = cartModel; ordermodel.User = currentUser; ordermodel.OrderNotes = orderNotes; ordermodel.CreationDate = DateTime.Now; _context.Add(ordermodel); await _context.SaveChangesAsync(); return(ordermodel); }