public async Task <ActionResult <Platform> > PostPlatform(Platform platform) { try { await _platformService.CreatePlatformAsync(platform); } catch (ArgumentNullException ex) { return(BadRequest(ex.Message)); } return(CreatedAtAction("GetPlatform", new { id = platform.Id }, platform)); }
public async Task <IActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } try { await _platformService.CreatePlatformAsync(Platform); } catch (Exception ex) { return(BadRequest(ex)); } return(RedirectToPage("./Platforms")); }