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

            return(Page());
        }
예제 #2
0
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Battle = repository.GetBattlesById(id.Value);

            if (Battle == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #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"));
        }
예제 #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"));
        }