public void Save() { if (Model.Id == null) { Model = facade.Create(Model) as UserModel; } else { facade.Update(Model); } }
private void AddNewPost() { Model.Author = loggedUser; Model.Comments = new List <CommentModel>(); Model.CorrespondingTeam = facade.ConvertTeamModelToTeamLightModel(LoadedTeam); Model.Date = DateTime.Now; Model.AssociatedFiles = new List <ContributionFileLightModel>(); Model.ContributionUserTags = new List <ContributionUserTagModel>(); Model = facade.Create(Model) as PostModel; facade.SetTaggedUserInPost(this.TaggedUsers, Model); mediator.Send(new ShowTeamPostsToggleVisibilityMessage { TeamModel = LoadedTeam }); mediator.Send(new PostAddedMessage()); }
private void AddNewComment() { Model.ParentContribution = new PostLightModel { Id = CorrespondingPostModel.Id }; Model.Date = DateTime.Now; Model.Author = loggedUser; Model.AssociatedFiles = new List <ContributionFileLightModel>(); Model.ContributionUserTags = new List <ContributionUserTagModel>(); Model = facade.Create(Model) as CommentModel; facade.SetTaggedUserInPost(this.TaggedUsers, Model); Visibility = false; mediator.Send(new CommentAddedMessage()); }
private void Save() { if (Model.Id == null) { Model = facade.Create(Model) as TeamModel; var lightTeam = new TeamLightModel { Id = Model.Id }; var lightUser = new UserLightModel { Id = Model.Admin.Id }; facade.JoinUserToTeam(lightUser, lightTeam); } else { facade.Update(Model); } }
private void createAccount(object parameter) { hideWarnings(); var hashedPasswords = getHashedPasswords(parameter).ToList(); if (facade.AreUserDataValid(Model.FirstName, Model.LastName, Model.Email, hashedPasswords[0], hashedPasswords[1])) { this.Model.Password = hashedPasswords[0]; var newUser = facade.Create(Model) as UserModel; UserLightModel newUserLightModel; try { newUserLightModel = new UserLightModel { Id = newUser.Id, FirstName = newUser.FirstName, LastName = newUser.LastName, Email = newUser.Email }; } catch (NullReferenceException) { ErrorWarning = true; return; } var message = new SuccessfullyRegisteredMessage() { User = newUserLightModel }; RegisterPageVisibility = false; mediator.Send(message); } else { sendWarning(hashedPasswords[0], hashedPasswords[1]); } }