public bool Update(UserAbout about) { DB.UsersInfo info = _dbCommands.FetchSingleRecord <UsersInfo>(about.UId); info.UAbout = about.About; info.UDesc = about.Desc; _dbCommands.ActionState(info, System.Data.Entity.EntityState.Modified); return(_dbCommands.Save()); }
/// <summary> /// 更新用户关于页信息 /// </summary> /// <param name="request"></param> /// <param name="userId"></param> /// <returns></returns> public async Task <ApiResult> UpdateUserAboutAsync(UpdateUserAboutRequest request, long userId) { var response = new ApiResult(); try { var about = await _userAboutRepository.Table .FirstOrDefaultAsync(item => item.UserId == userId); if (about == null) { //不存在则新建 var newAbout = new UserAbout(true) { Desc = request.Desc, CreateTime = DateTime.Now, UserId = userId, }; await _userAboutRepository.InsertAsync(newAbout); } else { //存在则修改 about.Desc = request.Desc; about.UpdateTime = DateTime.Now; } await _work.SaveChangesAsync(); response.Code = Code.Ok; response.Message = "操作成功"; return(response); } catch (Exception ex) { _logger.LogError($"更新用户关于页信息异常;method={nameof(UpdateUserAboutAsync)};param={request?.ToJson()};exception messges={ex.Message}"); response.Code = Code.Error; response.Message = $"更新用户关于页信息异常:{ex.Message}"; return(response); } }
void ReleaseDesignerOutlets() { if (AyarlarButton != null) { AyarlarButton.Dispose(); AyarlarButton = null; } if (BoostButton != null) { BoostButton.Dispose(); BoostButton = null; } if (BoostCountLabel != null) { BoostCountLabel.Dispose(); BoostCountLabel = null; } if (BuptisGoldButton != null) { BuptisGoldButton.Dispose(); BuptisGoldButton = null; } if (BuptisGoldToggle != null) { BuptisGoldToggle.Dispose(); BuptisGoldToggle = null; } if (FiltreButton != null) { FiltreButton.Dispose(); FiltreButton = null; } if (FotografEkleButton != null) { FotografEkleButton.Dispose(); FotografEkleButton = null; } if (GeriButton != null) { GeriButton.Dispose(); GeriButton = null; } if (HeaderHazne != null) { HeaderHazne.Dispose(); HeaderHazne = null; } if (KrediButton != null) { KrediButton.Dispose(); KrediButton = null; } if (KrediCountLabel != null) { KrediCountLabel.Dispose(); KrediCountLabel = null; } if (ProfilDuzenleButton != null) { ProfilDuzenleButton.Dispose(); ProfilDuzenleButton = null; } if (SuperBoostButton != null) { SuperBoostButton.Dispose(); SuperBoostButton = null; } if (SuperBoostCountLabel != null) { SuperBoostCountLabel.Dispose(); SuperBoostCountLabel = null; } if (UserAbout != null) { UserAbout.Dispose(); UserAbout = null; } if (UserJob != null) { UserJob.Dispose(); UserJob = null; } if (UserLastLocation != null) { UserLastLocation.Dispose(); UserLastLocation = null; } if (UserLocation != null) { UserLocation.Dispose(); UserLocation = null; } if (UserPhoto != null) { UserPhoto.Dispose(); UserPhoto = null; } if (UserTitle != null) { UserTitle.Dispose(); UserTitle = null; } }
partial void DeleteUserAbout(UserAbout instance);
partial void UpdateUserAbout(UserAbout instance);
partial void InsertUserAbout(UserAbout instance);
public void SaveData() { string AboutMe = AboutMeTxt.Text; string fName = UserFirstName.Text; string lName = UserLastName.Text; DateTime? BirthDate = Birthdate(UserAgeTxtBox.Text); bool? sex = GenderConvert(GenderList.SelectedValue); string Livingplace = UserLivingPlaceTxtBox.Text; GaymerLINQDataContext db = new GaymerLINQDataContext(); LoginLib login = new LoginLib(); int userID = Convert.ToInt32(Request.QueryString["UserId"]); if (userID == 0) { userID = login.GetUserID(); } var user = (from a in db.Users where a.UID == userID select a).FirstOrDefault(); if (user.AbID == null) { UserAbout about = new UserAbout(); about.Birthdate = BirthDate; about.FirstName = fName; about.LastName = lName; about.Gender = sex; about.Location = Livingplace; about.Users.Add(user); db.UserAbouts.InsertOnSubmit(about); } else { var about = (from a in db.UserAbouts where a.AbID == user.AbID select a).FirstOrDefault(); about.Birthdate = BirthDate; about.FirstName = fName; about.LastName = lName; about.Gender = sex; about.Location = Livingplace; } try { db.SubmitChanges(); } catch (Exception ab) { Response.Redirect("UserPage.aspx?db_feil"); } }