/// <summary> /// /// </summary> /// <param name="newKeysDto"></param> /// <returns></returns> public async Task <bool> UpdateCognitiveServiceKeys(CognitiveServiceKeysDto newKeysDto) { //Map the DTO object into the data entity var cogSvcDb = Mapper.Map <Data.Entities.CognitiveService>(newKeysDto); return(await _db.UpdateAsync(cogSvcDb)); }
public async void CreateCSKeys() { var keys = new CognitiveServiceKeysDto() { WorkspaceKey = "b798ac78-acf5-44e9-a405-46a85736fd8e", FaceApiKey = "73a191f1899e44ff9f14be1c81e9e7b7", EmotionApiKey = "837be46e535547ec8892f7fdf5cf1645" }; var result = await _service.CreateCognitiveServiceKeys(keys); Assert.Equal(true, result); }
public async Task <IActionResult> UpdateCognitiveServiceKeys([FromBody, Required] CognitiveServiceKeysDto csKeysDto) { try { if (csKeysDto == null) { return(BadRequest()); } var result = await _service.UpdateCognitiveServiceKeys(csKeysDto); return(CreatedAtRoute("default", result)); } catch (Exception ex) { Log.Error(ex, ex.Message); return(BadRequest(ex.Message)); } }
/// <summary> /// /// </summary> /// <param name="newKeysDto"></param> /// <returns></returns> public async Task <bool> CreateCognitiveServiceKeys(CognitiveServiceKeysDto newKeysDto) { //Map the DTO object into the data entity var cogSvcDb = Mapper.Map <Data.Entities.CognitiveService>(newKeysDto); //First, insert into child table await _db.InsertAsync(cogSvcDb); //Now, insert into the TeamCognitiveServices Table var teamCgnSvcDb = new TeamCognitiveService() { TeamId = newKeysDto.TeamId, CognitiveServiceId = cogSvcDb.Id }; await _db.InsertAsync(teamCgnSvcDb); return(cogSvcDb.Id > 0); }