示例#1
0
        /// <summary>
        /// 更新用户个人信息
        /// </summary>
        /// <param name="webModel">编辑页视图Model</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <bool> UpdateUserProfileAsync(ProfileViewModel webModel, ApplicationDbContext context)
        {
            try
            {
                //Update IdentityUser Data
                BasicRepository.UpdateAsync(webModel, context);

                //Add Operate Information
                var operate = string.Format("修改管理员信息,管理员编号:{0}", webModel.Id);
                PSURepository.InsertRecordAsync("IdentityUser", "BasicDomain", "UpdateUserProfileAsync", operate, (short)PSURepository.OperateCode.Update, Convert.ToInt64(webModel.Id), context);

                var index = await context.SaveChangesAsync();

                return(index == 2);
            }
            catch (Exception ex)
            {
                _logger.LogError("更新管理员信息失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
                return(false);
            }
        }