public IActionResult OnPost(string action) { IsGet = false; if (action == "Create") { // TODO: Check that the new Season does not Exist Already nor is it Active. var seasonEntity = new SeasonEntity() { Description = Description, BeginDateTimeUtc = BeginDateTimeUtc.Date, EndDateTimeUtc = EndDateTimeUtc.Date.AddDays(1).AddMilliseconds(-1), CreatedDateTimeUtc = DateTime.UtcNow }; SeasonsRepository.Create(seasonEntity); SeasonsRepository.SaveChanges(); } return(RedirectToPage("/web/Index")); }
public IActionResult OnPost(string action, int seasonId) { IsGet = false; // TODO: Check that the new Season Exists Already and is Active. if (action == "Update") { var seasonEntity = SeasonsRepository.Get(seasonId); if (seasonEntity != null) { seasonEntity.Description = Description; seasonEntity.EndDateTimeUtc = EndDateTimeUtc.Date.AddDays(1).AddMilliseconds(-1); seasonEntity.UpdatedDateTimeUtc = DateTime.UtcNow; SeasonsRepository.Update(seasonEntity); SeasonsRepository.SaveChanges(); } } return(RedirectToPage("/web/Index")); }