Пример #1
0
        public static OrganizationModel AddBoardToOrganization(AddBoardToOrganizationModel organizationAddBoard, string token)
        {
            var client  = new RestClient(BaseUrl);
            var request = InitRequest("/organizations/addBoard/" + token, Method.POST, organizationAddBoard);
            IRestResponse <OrganizationModel> response = client.Execute <OrganizationModel>(request);

            return(response.Data);
        }
Пример #2
0
        public SuccessfulMessageResponse AddBoardToOrganization([FromBody] AddBoardToOrganizationModel model, string token)
        {
            var session      = IsTokenExpired(token);
            var account      = _readOnlyRepository.First <Account>(account1 => account1.Id == session.User.Id);
            var organization = _readOnlyRepository.GetById <Organization>(model.Organization_id);

            if (organization != null)
            {
                var board = _mappingEngine.Map <AddBoardToOrganizationModel, Board>(model);
                board.Administrador = account;
                board.AddLanes(AccountHelpers.CreateLane("Basic", 1));
                board.AddLanes(AccountHelpers.CreateLane("Intermediate", 2));
                board.AddLanes(AccountHelpers.CreateLane("Advanced", 3));
                organization.AddBoard(board);
                return(new SuccessfulMessageResponse("Organization has been created"));
            }
            throw new BadRequestException("Board could not be added");
        }