public void AddUser(UserInfo user) { if (Model.Exists(user.Phone)) { View.AppendNotifierText("This user already exists"); } else { Model.Add(user); View.AppendNotifierText("New user was added"); } }
public void EditUser(UserInfo editedUser) { if (Model.Exists(editedUser.Name, editedUser.Surname, editedUser.Phone)) { View.AppendNotifierText("Not unique attributes"); } else { View.AppendNotifierText("User was edited."); Model.Edit(editedUser); View.DisableEdittingUsers(); } }
public void DeleteUser(UserInfo userInfo) { try { if (Model.Exists(userInfo.Name, userInfo.Surname)) { Model.Delete(userInfo.Name, userInfo.Surname); View.AppendNotifierText("User was deleted."); View.DisableEdittingUsers(); } else { View.AppendNotifierText("This user doesn't exist."); } } catch (ArgumentNullException) { View.ShowMessageBox("User is null"); } }