public IActionResult Create(Quote newQuote)
        {
            // if user is in session, for example, do this: newQuote.UserId = ...Session.GetInt32("userId")
            qFactory.Create(newQuote);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public void QuoteFactory_Simple()
        {
            const int N = 16; // NB: Ensure this value is higher than Creator<T, R>.CompilationInvocationThreshold.

            for (var i = 0; i < N; i++)
            {
                var foo  = new Foo();
                var expr = Expression.Constant(foo);
                var args = new object[] { i };

                var q1 = (QuotedFoo)QuoteFactory.Create <IFoo, QuotedFoo>(foo, expr, args);

                Assert.AreSame(foo, q1.Value);
                Assert.AreSame(expr, q1.Expression);
                Assert.AreEqual(args[0], q1.Argument);
            }
        }