コード例 #1
0
        public void Create(string name, string description)
        {
            DATA_MODELS.Project project = new DATA_MODELS.Project
            {
                Name        = name,
                Description = description
            };

            this.db.Add(project);
            this.db.SaveChanges();
        }
コード例 #2
0
        public void Delete(int id)
        {
            DATA_MODELS.Project project = this.db.Projects.Find(id);

            if (project == null)
            {
                return;
            }

            this.db.Remove(project);

            this.db.SaveChanges();
        }
コード例 #3
0
        public bool Edit(int id, string name, string description)
        {
            DATA_MODELS.Project project = this.db.Projects.FirstOrDefault(p => p.Id == id);

            if (project == null)
            {
                return(false);
            }

            project.Name        = name;
            project.Description = description;

            this.db.SaveChanges();

            return(true);
        }
コード例 #4
0
        private static void SeedProjects(TicketingSystemDbContext database)
        {
            var projectOne = new DATA_MODELS.Project
            {
                Name        = "Craft A Minecraft Creeper Robot",
                Description = "When I wrote my new book Make: Minecraft for Makers, " +
                              "you know I had to include a monster Creeper project. Here’s how you can build a motorized Creeper," +
                              " with a metal skeleton and wooden skin. Aside from the fact that this thing most certainly doesn’t blow up," +
                              " you’ll love it, and you’ll learn a lot about robotics and Arduino along the way. Let’s get to it!The Creeper consists of a robot chassis kit with" +
                              " add - on parts creating the mob’s distinctive armless body,with a servo motor to move the head around.Begin by taking a look at the Creeper in-game." +
                              "Just be sure to stick to Creative mode or you may find yourself getting blown up!"
            };

            var projectTwo = new DATA_MODELS.Project
            {
                Name        = "Light Up Leather Arm Braces",
                Description = "Wearable microcontrollers have found their way into cosplay, fashion, and daily wear but are usually textile based." +
                              " In this Skill Builder we’ll explore techniques for including leather in your wearables by examining my forearm bracer project," +
                              " which uses a built-in Adafruit Gemma and RGB NeoPixels that change color patterns with a simple capacitive touch of the medallion" +
                              " on its side. Read along and learn some key tips to working with leather and electronics, both on their own, and combined into one" +
                              " project.Leather is a favorite material of crafters,cosplayers,and makers for good reasons. It is moldable, cuttable, colorable," +
                              " and durable."
            };

            var projectThree = new DATA_MODELS.Project
            {
                Name        = "Edge-Lit LED Signs",
                Description = "Two things that most any hackerspace can benefit from are better signage explaining the space," +
                              " and festive LED decorations.In preparation for Noisebridge’s 10 - year anniversary in 2017 we decided to address both in one project;" +
                              " creating suspended LED signs that identify the work areas of our space in San Francisco.This type of signage is not uncommon," +
                              " but our extensive installation and our means of keeping costs down led to several requests for a tutorial. You can read more about it at the noisebridge" +
                              " blog, but here’s a quick overview of how we made and installed our 14 suspended, edge - lit LED signs."
            };

            var projectFour = new DATA_MODELS.Project
            {
                Name        = "Custom Canine Wheelchair",
                Description = "A friend needed a wheelchair for their French Bulldog at short notice. They were unable to afford the costly commercial wheelchairs available online." +
                              " I rose to the occasion to design something for an adorable dog, and the results were fantastic. Murray loved her chair!I’ve since built two other chairs for dogs," +
                              " and I’ve worked on iterating on what I call the “FiGO” design and documentation to encourage dog" +
                              " owners to tackle this project for their pet in need.This device uses parametrically designed 3D printed joint pieces that fit into acrylic or aluminum tubing.The tubing" +
                              " can be easily customized to the dog for both fit and style, and the 3D printed pieces can also be personalized via the Customizer application on Thingiverse.Currently screw size, tube outer diameter," +
                              " wheel angle, and your dog’s measurements can be input to view a rendering of your dog’s custom wheelchair."
            };

            var projectFive = new DATA_MODELS.Project
            {
                Name        = "Near-Field Fingernails",
                Description = "Nail art has seen some advances in the past decades, from the invention of cellulose-based polish 100 years ago, through thin plastic false nails, to the available-everywhere acrylic sculpted nails." +
                              " But it was about time nails went techno.On the security conference circuit,Baybe Doll(aka Emily Mitchell) had been getting her nail technician to embed small devices with readable data into her acrylic nails." +
                              "However,the technology wasn’t available to the masses,and when it was,it was big and chunky.NFC(near - field communication) tags are the solution; they’re tiny and they’re powered by nearby magnetic fields so they don’t need batteries." +
                              "The first NFC tag I tried to put on my nail was an NXP Mifare Ultralight C NTAG213 that I bought from a supplier to retail stores(it’s the thing that makes your shopping go beep when you leave if it hasn’t been deactivated). " +
                              "It was huge in comparison to the ones I use now."
            };

            var projectSix = new DATA_MODELS.Project
            {
                Name        = "Quick Mini-Loom Ornament",
                Description = "One of the most fun and satisfying projects in my book Fabric and Fiber Inventions is the little cardboard loom. With just some scraps of board and bits of yarn, you can make really interesting weavings." +
                              " While the pieces in the book are coaster-sized, I decided it would be fun to make a mini-loom and create a tiny weaving that could be worn as a necklace or hung as an ornament in a window or on the tree. For a festive touch," +
                              " I added an LED light at the top and miniature bells instead of fringe!Making the loom takes only a few minutes,and it’s a great idea if your kids are looking for a last-minute homemade gift to make.You can turn out a weaving in under an hour." +
                              "If you’re careful, you can even re - use the loom for several projects. I made a Christmas tree design, but if you have some left - over yarn it also looks nice with just stripes of different colors and textures."
            };

            var projectSeven = new DATA_MODELS.Project
            {
                Name        = "Program a Light-Up Felt Menorah",
                Description = "Everyone has their own holiday traditions. Mine is trying to make an LED menorah for Hanukkah, the Jewish Festival of Lights. This year, Hanukkah starts on the night of Tuesday, December 12, and, as always, I didn’t leave myself a lot of time to play around." +
                              " But I wanted to update a prototype I made a few years ago, so I gave it a shot.Hanukkah lasts for eight nights, and on each night a candle is added to the candelabra known as the menorah.A ninth “helper” candle, or shamash, is used to light the other candles.Menorahs come in all varieties, from simple to ornate and from elegant to playful." +
                              "In the United States, it’s common for kids to make their own.Mine is similar to the simple soft circuit projects in my books Paper Inventions and Fabric and Fiber Inventions.Taking a cue from preschool-style felt boards, I decided to use felt as the base material, so I could just press an additional candle onto the menorah every night." +
                              "And instead of wiring, it uses peel - and - stick conductive tape and Chibitronics Circuit Stickers, LEDs that adhere right onto the tape circuits.It’s easy enough for a child (or a non - techy adult) to make in an afternoon."
            };

            var projectEight = new DATA_MODELS.Project
            {
                Name        = "Livestream-Interactive Confetti Cannon",
                Description = "Ok, I’ll admit, this one is a little silly – but ever since I’ve been doing live broadcasts on the regular, I’ve wanted to increase the number of ways that live stream audiences can interact with the broadcast. I was inspired by projects like Twitch Plays Pokemon and letsrobot.tv, and wanted to create an easy to use system so people" +
                              " can easily create whatever hardware they imagine, and let their audiences take control of it, no matter what platform they’re streaming on.It turns out that for Twitch.TV, it’s a relatively simple task.Twitch’s chat is based on IRC(the Internet Relay Chat protocol) so it’s relatively simple to have a wifi - capable microcontroller sign into that IRC" +
                              " server, start listening in on the chat, and when it detects certain keywords, can trigger a hardware event. But I wanted a system that would be completely platform agnostic, so I turned to my favorite mobile IoT solution, Blynk."
            };

            var projectNine = new DATA_MODELS.Project
            {
                Name        = "Draw Abstract Art",
                Description = "When I wrote my new book Make: Minecraft for Makers, you know I had to include a monster Creeper project. Here’s how you can build a motorized Creeper, with a metal skeleton and wooden skin. Aside from the fact that this thing most certainly doesn’t blow up, you’ll love it, and you’ll learn a lot about" +
                              " robotics and Arduino along the way. Let’s get to it!The Creeper consists of a robot chassis kit with add - on parts creating the mob’s distinctive armless body,with a servo motor to move the head around.Begin by taking a look at the Creeper in-game.Just be sure to stick to Creative mode or you may find yourself getting blown up!"
            };

            var projectTen = new DATA_MODELS.Project
            {
                Name        = "Craft A Minecraft Creeper Robot",
                Description = "The Robot Creeper seems super challenging at first. The thing has to look like a Creeper, ideally proportionate with the game element. At the same time, it also has to function as a robot. In other words, regardless of its outer appearance," +
                              " the Creeper has to be able to fit all the necessary robotic components, particularly the chassis kit we’re using for the base.I began with the Actobotics Bogie Runt Rover,a kit available for around $70 that comes with a chassis, six motors, and six wheels." +
                              "The assembled rover’s chassis measures 6″×9″, though the wheels project a little, and it rides fairly high: 6″ off the ground.With those measurements I was able to decide the size of the footprint: 12″×8″ — conveniently, one inch per pixel."
            };

            var projectEleven = new DATA_MODELS.Project
            {
                Name        = "CNC Cut a Family Heirloom Step Stool",
                Description = "As far back as I can remember there was a fixture in all of my family member’s houses: a little wooden stool. Purchased by my great uncle Frank, an engineer, from one of his co-workers for every female relative, my mother’s copy was my breakfast table during Saturday morning cartoons;" +
                              " the fort for epic battles between my action figures; and my workbench for my first woodworking project around the age of 7. When my grandmother passed away, the one thing I asked for was her stool.One day I spotted my wife sitting in front of our fireplace on my grandmother’s stool and it hit me:" +
                              " I would redesign that stool to be cut on a router.I hope that my uncle Frank’s family gift can spread to be the first workbench, drafting table, or thinking seat for a new generation of makers."
            };

            database.Projects.AddRange(projectOne, projectTwo, projectThree, projectFour, projectFive, projectSix, projectSeven, projectEight, projectNine, projectTen, projectEleven);
            database.SaveChanges();
        }