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

            return(Page());
        }
        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"));
        }