Example #1
0
 public async Task <ResponseDto <GoogleUser> > UpdateAsync(GoogleUser entity)
 {
     return(await Task.Run(async() =>
     {
         _logger.Information($"UpdateAsync: Trying to update userId = {entity.ID}");
         var response = new ResponseDto <GoogleUser>
         {
             Message = string.Empty,
             Succeed = false
         };
         using (var context = new MiraiNotesContext())
         {
             try
             {
                 context.Entry(entity).State = EntityState.Modified;
                 response.Succeed = await context.SaveChangesAsync() > 0;
                 response.Result = entity;
                 _logger.Information("UpdateAsync: Completed successfully");
             }
             catch (Exception e)
             {
                 _logger.Error(e, "UpdateAsync: An unknown error occurred");
                 response.Message = GetExceptionMessage(e);
             }
         }
         return response;
     }).ConfigureAwait(false));
 }