Beispiel #1
0
        public async Task <IHttpActionResult> Delete([FromBody] ShoppingCartItemDeleteModal modal)
        {
            var result = new ApiResult <string>();
            var userId = User.Identity.GetUserId();
            var items  = ShoppingCartItemService
                         .GetAll()
                         .Where(x => modal.Ids.Contains(x.Id) &&
                                x.CustomerId == userId).ToList();

            foreach (var entity in items)
            {
                await ShoppingCartItemService.DeleteAsync(entity);
            }
            result.Data = "删除成功!";
            return(Ok(result));
        }