Exemplo n.º 1
0
        public IActionResult OnGet()
        {
            if (Quote.Id != 0)
            {
                return(RedirectToPage("./Edit"));
            }

            Quote = new SamuraiApp.Domain.Quotes();

            var list = samurairepo.GetSamurais().ToList().Select(x => new { Id = x.Id, SamuraiName = $"{x.Name}" });

            Samurais = new SelectList(list, "Id", "SamuraiName");
            return(Page());
        }
Exemplo n.º 2
0
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Quote = repository.GetQuoteById(id.Value);

            if (Quote != null)
            {
                repository.Delete(Quote.Id);
            }
            repository.Commit();
            return(RedirectToPage("./Index"));
        }
Exemplo n.º 3
0
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Quote = repository.GetQuoteById(id.Value);

            if (Quote == null)
            {
                return(NotFound());
            }

            return(Page());
        }