public async Task <Meal> CreateMeal(Meal meal) { _context.Entry(meal).State = EntityState.Added; await _context.SaveChangesAsync(); return(meal); }
/// <summary> /// Async method to create a category, that is used from the controller /// </summary> /// <param name="category"></param> /// <returns>a new category on the categories page</returns> public async Task <Category> CreateCategory(Category category) { _context.Entry(category).State = EntityState.Added; await _context.SaveChangesAsync(); return(category); }
public async Task <CreateCart> Create(CreateCart cart) { CreateCart newCart = new CreateCart() { UserId = cart.UserId }; _context.Entry(newCart).State = EntityState.Added; await _context.SaveChangesAsync(); return(newCart); }