Пример #1
0
        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());
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
 public async Task <bool> DeleteAsync([FromBody] MessageDeleteDTO dto)
 {
     return(await _messageService.DeleteAsync(dto));
 }