/// <summary> /// 更新一条数据 /// </summary> public static bool Update(AccountsUsers model) { IAccountAppService service = IocManager.Instance.Resolve <IAccountAppService>(); if (service == null) { return(false); } else { var accountDto = ConvertFromBllEntity(model); return(service.Update(accountDto) > 0); } }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Add(AccountsUsers model) { IAccountAppService service = IocManager.Instance.Resolve <IAccountAppService>(); if (service == null) { return(false); } else { var accountDto = ConvertFromBllEntity(model); accountDto.AccountId = Guid.NewGuid().ToString(); return(service.Add(accountDto)); } }
private static AccountsUsers ConvertFromDto(AccountDto accountDto) { if (accountDto == null) { return(null); } AccountsUsers user = new AccountsUsers() { Email = accountDto.Email, Phone = accountDto.Phone, Password = accountDto.Password, Sex = accountDto.Sex ? "男" : "女", UserID = accountDto.AccountId, TrueName = accountDto.TrueName, Activity = accountDto.Activity, Style = accountDto.Style, UserName = accountDto.UserName, UserType = accountDto.UserType, LastLoginIP = accountDto.LastLoginIP, LastLoginTime = accountDto.LastLoginTime }; return(user); }
private static AccountDto ConvertFromBllEntity(AccountsUsers accountUser) { if (accountUser == null) { return(null); } AccountDto accountDto = new AccountDto() { Email = accountUser.Email, Phone = accountUser.Phone, Password = accountUser.Password, Sex = (accountUser.Sex == "男" ? true : false), AccountId = accountUser.UserID, TrueName = accountUser.TrueName, Activity = accountUser.Activity, Style = accountUser.Style.Value, UserName = accountUser.UserName, UserType = accountUser.UserType, LastLoginIP = accountUser.LastLoginIP, LastLoginTime = accountUser.LastLoginTime }; return(accountDto); }