public ReturnModel CreateBoard([FromBody] AccountBoardsModel model, long idOrganization, string accesToken) { var account = _readOnlyRepository.First <Account>(account1 => account1.Token == accesToken); ReturnModel remodel = new ReturnModel(); if (account != null) { if (account.VerifyToken(account)) { Organization organization = _readOnlyRepository.GetById <Organization>(idOrganization); Board board = _mappingEngine.Map <AccountBoardsModel, Board>(model); board.Administrator = account; Board boardCreated = _writeOnlyRepository.Create(board); if (boardCreated != null) { organization.AddBoard(boardCreated); Activity activity = new Activity(); activity.Text = account.FirstName + " Creo un board"; account.AddActivities(activity); var organizacionUpdate = _writeOnlyRepository.Update(organization); var accountUpdate = _writeOnlyRepository.Update(account); return(remodel.ConfigureModel("Succesfull", "Se creo el board correctamente", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo crear el board", remodel)); } return(remodel.ConfigureModel("Error", "Su session ya expiro", remodel)); } return(remodel.ConfigureModel("Error", "No se pudo acceder a su cuenta", remodel)); }
public static Organization CreateOrganizationDefault(Account account, string title, string desc) { var organization = new Organization { Title = title, Administrador = account, Description = desc, IsArchived = false }; organization.AddMember(account); organization.AddBoard(CreateBoard(account)); account.AddOrganization(organization); return(organization); }
public static Organization CreateOrganization(Account account) { var organization = new Organization { Title = "Welcome Organization", Administrador = account, Description = "This is your first Organization", IsArchived = false }; organization.AddMember(account); organization.AddBoard(CreateBoard(account)); account.AddOrganization(organization); return(organization); }