public IActionResult OnPost(int id)
        {
            _service.DeleteWithActionAndSave <Author>(CheckIfInOrder, id);
            if (_service.IsValid)
            {
                return(RedirectToPage("Index", new { message = _service.Message }));
            }

            //Error state
            _service.CopyErrorsToModelState(ModelState, Data, nameof(Data));
            return(Page());
        }
Пример #2
0
        public ActionResult <WebApiMessageOnly> Delete2()
        {
            _services.DeleteWithActionAndSave <User>((context, user) =>
            {
                var status = new StatusGenericHandler();
                // status.AddError("error");

                status.Message = "success";

                var any = context.Set <User>().Any(a => a.Id == user.Id);

                Console.WriteLine($"--- {nameof(Delete2)} ---");
                Console.WriteLine($"any - {any}");

                return(status);
            }, Guid.Parse("d88fbbb3-0858-43e1-b891-d49b32bfdece"));

            Console.WriteLine("--- update ---");
            Console.WriteLine($"isvalid - {_services.IsValid}");
            Console.WriteLine($"message - {_services.Message}");
            Console.WriteLine($"errors - {JsonSerializer.Serialize(_services.Errors)}");

            return(_services.Response());
        }