public async Task <bool> DeleteAsync(MessageDeleteDTO dto) { var uri = API.OaMessage.DeleteAsync(_baseUrl); var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json"); var response = await _apiClient.PostAsync(uri, content); response.EnsureSuccessStatusCode(); string res = await response.Content.ReadAsStringAsync(); return(res.ToLower() == bool.TrueString.ToLower()); }
public async Task <bool> DeleteAsync(MessageDeleteDTO dto) { using (var tran = _databaseFixture.Db.BeginTransaction()) { try { var list = await _databaseFixture.Db.OaMessage.GetByIds(dto.Ids); foreach (var item in list) { item.IsDel = 1; await _databaseFixture.Db.OaMessage.UpdateAsync(item); } tran.Commit(); return(true); } catch (Exception ex) { tran.Rollback(); return(false); } } }
public async Task <bool> DeleteAsync([FromBody] MessageDeleteDTO dto) { return(await _messageService.DeleteAsync(dto)); }