Example #1
0
        public async Task <Meal> CreateMeal(Meal meal)
        {
            _context.Entry(meal).State = EntityState.Added;
            await _context.SaveChangesAsync();

            return(meal);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        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);
        }