public Window CreateUserAddView(UserWrite user) { return(new UserEditorWindow { DataContext = _viewModelFactory.CreateUserAddViewModel(user), FontFamily = _fontFamily }); }
public UserRead UpdateUser(HttpRequestMessage requestMessage, UserWrite newUser) { var user = Mapper.Map <Data.Shared.Models.User>(newUser); DataProxy.Instance.MembershipRepository.UpdateUser(user); return(Mapper.Map <UserRead>(user)); }
public IHttpActionResult AddUser(HttpRequestMessage requestMessage, UserWrite newUser) { var user = Mapper.Map <Data.Shared.Models.User>(newUser); DataProxy.Instance.MembershipRepository.InsertUser(user); var userRead = Mapper.Map <UserRead>(user); return(new CreatedActionResult <UserRead>(requestMessage, userRead)); }
public async Task <bool> CreateUser(UserWrite user) { var response = await RequestCreate <UserRead, UserWrite>(UsersUrl, user); if (response != null) { user.UserId = response.Results.UserId; } return(response != null); }
public object CreateUserAddViewModel(UserWrite user) { return(new UserEditorWindowViewModel { SaveCommand = _commandFactory.CreateUserCommand(), CancelCommand = _commandFactory.CloseWindowCommand(), User = user, Roles = _dataFactory.Roles, Languages = _languageService.Languages }); }
static void Main(string[] args) { string FileName; //文件名称 string UserWrite; //用户输入内容 string[] ParName = new string[5]; //操作名称 int[] ParmeterResult = new int[5]; //文件操作的返回结果 UserWrite = Console.ReadLine(); string[] AllFileName = new string[50]; //存储所有输入过的文件名 string[] AllParName = new string[50]; //存储所有操作名 int i = 0; while (UserWrite != "###") { string[] Parameter = UserWrite.Split(' '); //文件执行操作类型 FileName = Parameter[Parameter.Length - 1]; AllFileName[i] = FileName; for (int j = 1; j < Parameter.Length - 1; j++) { if (Parameter[j] == "-c") //得到字符总数 { ParmeterResult[j] = CodeCount(FileName); ParName[j] = "字符数"; } else if (Parameter[j] == "-w") //得到单词总数 { ParmeterResult[j] = WordCount(FileName); ParName[j] = "单词数"; } else if (Parameter[j] == "-l") //得到总行数 { ParmeterResult[j] = LineCount(FileName); ParName[j] = "行数"; } else if (Parameter[j] == "-o") //将结果写入文件 { for (int k = 1; k <= Parameter.Length - 1; k++) { OutPut(AllFileName[i - 1] + "," + ParName[k] + ":" + ParmeterResult[k], AllFileName[i]); Console.WriteLine(AllFileName[i - 1] + "," + ParName[k] + ":" + ParmeterResult[k]); } continue; } Console.WriteLine(FileName + "," + ParName[j] + ":" + ParmeterResult[j]); } UserWrite = Console.ReadLine(); i++; } }
private int IndexOfUserById(UserWrite userWrite) { for (var i = 0; i < _users.Count; i++) { var user = _users[i]; if (user.UserId == userWrite.UserId) { return(i); } } return(-1); }
internal async Task CreateUser(UserWrite userWrite) { LogWarning(Localized.Resources.StatusConnecting); var successful = await _membershipService.CreateUser(userWrite); if (successful) { _users.Add(userWrite); LogSuccess(Localized.Resources.StatusItemCreated); } else { LogFailure(Localized.Resources.StatusFailedToCreateItem); } }
internal async Task UpdateUser(UserWrite userWrite) { LogWarning(Localized.Resources.StatusConnecting); var successful = await _membershipService.UpdateUser(userWrite); if (successful) { var index = IndexOfUserById(userWrite); _users.RemoveAt(index); _users.Insert(index, Mapper.Map <UserRead>(userWrite)); LogSuccess(Localized.Resources.StatusItemUpdated); } else { LogFailure(Localized.Resources.StatusFailedToUpdatedItem); } }
public async Task <bool> UpdateUser(UserWrite user) { return(await RequestUpdate(UsersUrl, user)); }
public void DisplayUserAddWindow(UserWrite user) { _viewFactory.CreateUserAddView(user).Show(); }