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); }
public HomeController(BreakfastDbContext context) { this.context = context; }
public CategoryController(BreakfastDbContext context) { this.context = context; }
public OrderController(BreakfastDbContext context) { this.context = context; }
public ProductController(BreakfastDbContext context) { this.context = context; }
public static Client GetClient(this HttpRequest request, BreakfastDbContext context) { var client = context.Clients.Where(a => a.ClientToken == GetClientToken(request)).FirstOrDefault(); return(client); }
public MainController(BreakfastDbContext context) { this.context = context; }
public BasketController(BreakfastDbContext context) { this.context = context; }