public async Task <IActionResult> Cart( int id, [FromServices] GetListsFull getListsFull, [FromServices] AddToCart addToCart, bool redirectToCheckout = false) { var mark = GetCartUserMark(); var list = getListsFull.Do(mark.userId).FirstOrDefault(x => x.Id == id); foreach (var product in list.Products) { await addToCart.Do(new AddToCart.Request { UserMark = mark, ProductId = product.Id, Qty = product.Qty == 0 ? 1 : product.Qty }); } if (redirectToCheckout) { return(RedirectToPage("/Checkout/Index")); } return(Ok()); }
public DetailModel(GetListsFull getListsFull, UpdateList updateList) { this._getListsFull = getListsFull; this._updateList = updateList; }
public IActionResult Get([FromServices] GetListsFull getListsFull) => Ok(getListsFull.Do(GetUserId()));
public IndexModel(GetListsFull getListsFull, DeleteList deleteList) { this._getListsFull = getListsFull; this._deleteList = deleteList; }