public async Task <IActionResult> Post([FromBody] MetaHumanAbility ma) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var stored = await this.metahumanAbilitiesRepository.AddAsync(ma); return(Ok(new { id = new { stored.MetaHumanId, stored.AbilityId } })); } catch (DbUpdateException) { if (await this.metahumanAbilitiesRepository.EntityExists(ma)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } }
public async Task <IActionResult> Delete([FromBody] MetaHumanAbility ma) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var ha = await this.metahumanAbilitiesRepository.DeleteAsync(ma.MetaHumanId, ma.AbilityId); return(Ok(new { id = new { ha.MetaHumanId, ha.AbilityId } })); } catch (DbUpdateException ex) { return(BadRequest(ex.Message)); } }