public async Task <Models.Sample.Order> CreateOrder(Models.Sample.Order order)
        {
            OnOrderCreated(order);

            context.Orders.Add(order);
            context.SaveChanges();

            return(order);
        }
        public async Task <Models.Sample.Order> CancelOrderChanges(Models.Sample.Order item)
        {
            var entity = context.Entry(item);

            entity.CurrentValues.SetValues(entity.OriginalValues);
            entity.State = EntityState.Unchanged;

            return(item);
        }
示例#3
0
        protected async System.Threading.Tasks.Task Form0Submit(BlazorCustomPaging.Models.Sample.Order args)
        {
            try
            {
                var sampleCreateOrderResult = await Sample.CreateOrder(order);

                DialogService.Close(order);
            }
            catch (Exception sampleCreateOrderException)
            {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to create new Order!");
            }
        }
        public async Task <Models.Sample.Order> UpdateOrder(int?id, Models.Sample.Order order)
        {
            OnOrderUpdated(order);

            var item = context.Orders
                       .Where(i => i.Id == id)
                       .FirstOrDefault();

            if (item == null)
            {
                throw new Exception("Item no longer available");
            }
            var entry = context.Entry(item);

            entry.CurrentValues.SetValues(order);
            entry.State = EntityState.Modified;
            context.SaveChanges();

            return(order);
        }
示例#5
0
 protected async System.Threading.Tasks.Task Load()
 {
     order = new BlazorCustomPaging.Models.Sample.Order()
     {
     };
 }
 partial void OnOrderCreated(Models.Sample.Order item);
 partial void OnOrderGet(Models.Sample.Order item);
 partial void OnOrderDeleted(Models.Sample.Order item);
        protected async System.Threading.Tasks.Task Grid0RowSelect(BlazorCustomPaging.Models.Sample.Order args)
        {
            var dialogResult = await DialogService.OpenAsync <EditOrder>("Edit Order", new Dictionary <string, object>() { { "Id", args.Id } });

            await InvokeAsync(() => { StateHasChanged(); });
        }
        protected async System.Threading.Tasks.Task Load()
        {
            var sampleGetOrderByIdResult = await Sample.GetOrderById(Id);

            order = sampleGetOrderByIdResult;
        }