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

            return(Page());
        }
Exemplo n.º 2
0
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Battle = repository.GetBattlesById(id.Value);

            if (Battle == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 3
0
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Battle = repository.GetBattlesById(id.Value);

            if (Battle != null)
            {
                Battle = repository.Delete(Battle.Id);
            }

            repository.Commit();
            return(RedirectToPage("./Index"));
        }
Exemplo n.º 4
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (Battle.Id == 0)
            {
                Battle = repository.Create(Battle);
            }
            else
            {
                Battle = repository.Update(Battle);
            }

            repository.Commit();
            return(RedirectToPage("./Index"));
        }