예제 #1
0
        public async Task InvokeAsync(HttpContext context, BreakfastDbContext breakfastContext)
        {
            var cookieId = context.Request.GetClientToken();

            if (cookieId == null)
            {
                var guid = Guid.NewGuid().ToString();
                context.Response.Cookies.Append("ClientToken", guid);
                breakfastContext.Clients.Add(new Client {
                    ClientToken = guid
                });
                breakfastContext.SaveChanges();
            }
            await next.Invoke(context);
        }
예제 #2
0
 public HomeController(BreakfastDbContext context)
 {
     this.context = context;
 }
예제 #3
0
 public CategoryController(BreakfastDbContext context)
 {
     this.context = context;
 }
예제 #4
0
 public OrderController(BreakfastDbContext context)
 {
     this.context = context;
 }
예제 #5
0
 public ProductController(BreakfastDbContext context)
 {
     this.context = context;
 }
예제 #6
0
        public static Client GetClient(this HttpRequest request, BreakfastDbContext context)
        {
            var client = context.Clients.Where(a => a.ClientToken == GetClientToken(request)).FirstOrDefault();

            return(client);
        }
예제 #7
0
 public MainController(BreakfastDbContext context)
 {
     this.context = context;
 }
예제 #8
0
 public BasketController(BreakfastDbContext context)
 {
     this.context = context;
 }