public IHttpActionResult PutSchoolEvent(int id, SchoolEvent schoolEvent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != schoolEvent.Id)
            {
                return(BadRequest());
            }

            try
            {
                //Updates SchoolEvent.
                _db.Update(schoolEvent);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SchoolEventExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public void Detail_Refresh()
 {
     if (CalendarEvent != null)
     {
         Titel_textBox.Text     = CalendarEvent.Titel;
         Note_textBox.Text      = CalendarEvent.Notes;
         Start_datePicker.Value = CalendarEvent.StartDate.Date;
         Start_TimePicker.Value = CalendarEvent.StartDate;
         End_datePicker.Value   = CalendarEvent.EndDate.Date;
         End_TimePicker.Value   = CalendarEvent.EndDate;
         if (CalendarEvent.GetType() == typeof(SchoolEvent))
         {
             SchoolEvent schoolDetails = (SchoolEvent)CalendarEvent;
             Subject_label.Visible      = true;
             Subject_textBox.Visible    = true;
             Subject_textBox.Text       = schoolDetails.Subject;
             Assignment_label.Visible   = true;
             Assignment_textBox.Visible = true;
             Assignment_textBox.Text    = schoolDetails.Assignment;
         }
         if (CalendarEvent.GetType() == typeof(GameEvent))
         {
             GameEvent gameDetails = (GameEvent)CalendarEvent;
             Game_label.Visible    = true;
             Game_comboBox.Visible = true;
             Game_comboBox.Text    = gameDetails.GameName;
         }
     }
 }
Example #3
0
 public ActionResult Edit([Bind(Include = "Id,Minuttes,Name")] SchoolEvent schoolEvent)
 {
     if (ModelState.IsValid)
     {
         _schoolEventserviceGateway.Update(schoolEvent);
         return(RedirectToAction("Index"));
     }
     return(View(schoolEvent));
 }
        public IHttpActionResult PostSchoolEvent(SchoolEvent schoolEvent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //Creates SchoolEvent
            _db.Create(schoolEvent);
            return(CreatedAtRoute("DefaultApi", new { id = schoolEvent.Id }, schoolEvent));
        }
        public IHttpActionResult GetSchoolEvent(int id)
        {
            //Read School by Id.
            SchoolEvent schoolEvent = _db.Read(id);

            if (schoolEvent == null)
            {
                return(NotFound());
            }

            return(Ok(schoolEvent));
        }
Example #6
0
        // GET: SchoolEvents/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SchoolEvent schoolEvent = _schoolEventserviceGateway.Read(id.Value);

            if (schoolEvent == null)
            {
                return(HttpNotFound());
            }
            return(View(schoolEvent));
        }
        public IHttpActionResult DeleteSchoolEvent(int id)
        {
            //Read SchoolEvent by Id.
            SchoolEvent schoolEvent = _db.Read(id);

            if (schoolEvent == null)
            {
                return(NotFound());
            }

            //Deletes SchoolEvent.
            _db.Delete(schoolEvent);

            return(Ok(schoolEvent));
        }
        [HttpPut]  /*POSTMAN OK*/
        public IActionResult Update([FromBody] SchoolEvent schoolEvent)
        {
            switch (_eventRepo.Update(schoolEvent))
            {
            case DBErrors.Success:
                return(Ok());

            case DBErrors.NullExeption:
                return(Problem("A mandatory field does not support 'null' value or is missing", statusCode: (int)HttpStatusCode.BadRequest));

            case DBErrors.Name_Exist:
                return(Problem("This name already exist.", statusCode: (int)HttpStatusCode.BadRequest));

            default:
                return(Problem("?", statusCode: (int)HttpStatusCode.NotFound));
            }
        }
Example #9
0
        public static Schedule Parse(string data)
        {
            Schedule schedule      = new Schedule();
            int      academicYear  = ParseAcademicYear(data);
            var      regex         = new Regex("valign=\"top\"[^>]*><p>((?:(?!<\\/p>).)+)", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline);
            var      matches       = regex.Matches(data);
            var      eventRegex    = new Regex("(?:<br \\/>)?\\s*\\(?([^\\)]+)\\)((?:(?!<br \\/>|\\(\\d).)+)", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline);
            var      dateRegex     = new Regex("(\\d+)\\/(\\d+)");
            var      endCommaRegex = new Regex("、\\s?$", RegexOptions.Multiline);

            foreach (Match match in matches)
            {
                var eventMatches = eventRegex.Matches(match.Groups[1].Value);
                foreach (Match eventMatch in eventMatches)
                {
                    SchoolEvent schoolEvent = new SchoolEvent();
                    schoolEvent.timeString  = eventMatch.Groups[1].Value.Replace('~', '-');
                    schoolEvent.description = endCommaRegex.Replace(eventMatch.Groups[2].Value, "");
                    //Get date
                    var dateMatch = dateRegex.Match(schoolEvent.timeString);
                    int month     = int.Parse(dateMatch.Groups[1].Value);
                    int day       = int.Parse(dateMatch.Groups[2].Value);
                    int year      = (month > 7 ? academicYear : academicYear + 1) + 1911;
                    schoolEvent.date = new DateTime(year, month, day);

                    //Insert into event list
                    schedule.events.Add(schoolEvent);
                    //Insert into month schedule
                    if (!schedule.monthSchedules.ContainsKey(month))
                    {
                        schedule.monthSchedules.Add(month, new List <SchoolEvent>());
                    }
                    var monthSchedule = schedule.monthSchedules[month];
                    monthSchedule.Add(schoolEvent);
                }
            }
            return(schedule);
        }
Example #10
0
        public IActionResult Create(CreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            SchoolEvent schoolevent = new SchoolEvent()
            {
                Id           = Guid.NewGuid(),
                Title        = model.Title,
                Description  = model.Description,
                Content      = model.Content,
                PostExpiry   = model.PostExpiry,
                IsPublished  = true,
                TemplateName = "post1",
                EventStart   = model.EventStart,
                EventEnd     = model.EventEnd
            };

            this._context.SchoolEvents.Add(schoolevent);
            this._context.SaveChanges();
            return(View());
        }
        public void PopulateAndUseClasses()
        {
            // school events
            SchoolEvent s = new SchoolEvent();

            s.EventDate     = DateTime.Today;
            s.EventName     = "TestEvent";
            s.RoomEventIsIn = "TestRoom";

            Assert.AreEqual(DateTime.Today, s.EventDate);
            Assert.AreEqual("TestEvent", s.EventName);
            Assert.AreEqual("TestRoom", s.RoomEventIsIn);

            // work events
            WorkEvent w = new WorkEvent();

            w.EventDate   = DateTime.Today;
            w.EventName   = "TestEvent";
            w.MeetingTime = 0900;

            Assert.AreEqual(DateTime.Today, w.EventDate);
            Assert.AreEqual("TestEvent", w.EventName);
            Assert.AreEqual(0900, w.MeetingTime);


            // life events
            LifeEvent l = new LifeEvent();

            l.EventDate = DateTime.Today;
            l.EventName = "TestEvent";
            l.Location  = "TestLocation";

            Assert.AreEqual(DateTime.Today, l.EventDate);
            Assert.AreEqual("TestEvent", l.EventName);
            Assert.AreEqual("TestLocation", l.Location);
        }
        public void Test_AddCalenderEvent()
        {
            CalendarEvent testEvent  = new CalendarEvent("testEvent", "t", TestTime, TestTime, "");
            CalendarEvent test2Event = testEvent;

            Assert.AreEqual(testEvent, test2Event);
            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testEvent", "t", TestTime, TestTime, null, null, null, ""));
            Assert.IsTrue(CalendarEventAdministration.Agenda.Contains(testEvent));

            try
            {
                CalendarEventAdministration.AddCalendarEvent("testEvent", "t", TestTime, TestTime, null, null, null, "");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment already exist in agenda");
            }

            CalendarEvent testDBEvent = new CalendarEvent("testDBEvent", "test", TestTime, TestTime, "*****@*****.**");

            Assert.AreNotEqual(testEvent, testDBEvent);
            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBEvent", "test", TestTime, TestTime, null, null, null, "*****@*****.**"));
            Assert.IsTrue(CalendarEventAdministration.Agenda.Contains(testDBEvent));

            try
            {
                CalendarEventAdministration.AddCalendarEvent("testDBEvent", "tt", TestTime, TestTime,
                                                             null, null, null, "*****@*****.**");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment already exist in agenda");
            }

            SchoolEvent testSchool  = new SchoolEvent("testSchool", "t", TestTime, TestTime, "unit", "test", "");
            SchoolEvent test2School = testSchool;

            Assert.AreEqual(testSchool, test2School);
            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testSchool", "t", TestTime, TestTime, "unit", "test", null, ""));
            Assert.IsTrue(CalendarEventAdministration.Agenda.Contains(testSchool));

            try
            {
                CalendarEventAdministration.AddCalendarEvent("testSchool", "t", TestTime, TestTime, "unit",
                                                             "test", null, "");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment already exist in agenda");
            }

            SchoolEvent testDBSchool = new SchoolEvent("testDBSchool", "tt", TestTime, TestTime, "unit", "test", "*****@*****.**");

            Assert.AreNotEqual(testSchool, testDBSchool);
            Assert.AreNotEqual(testEvent, testDBSchool);
            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBSchool", "tt", TestTime, TestTime, "unit", "test", null, "*****@*****.**"));
            Assert.IsTrue(CalendarEventAdministration.Agenda.Contains(testDBSchool));

            try
            {
                CalendarEventAdministration.AddCalendarEvent("testDBSchool", "tt", TestTime, TestTime, "unit",
                                                             "test", null, "*****@*****.**");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment already exist in agenda");
            }

            GameEvent testGame  = new GameEvent("testGame", "t", TestTime, TestTime, "Game", "");
            GameEvent test2Game = testGame;

            Assert.AreEqual(testGame, test2Game);
            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testGame", "t", TestTime, TestTime, null, null, "Game", ""));
            Assert.IsTrue(CalendarEventAdministration.Agenda.Contains(testGame));

            try
            {
                CalendarEventAdministration.AddCalendarEvent("testGame", "t", TestTime, TestTime, null, null, "Game", "");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment already exist in agenda");
            }

            GameEvent testDBGame = new GameEvent("testDBGame", "tt", TestTime, TestTime, "Game", "*****@*****.**");

            Assert.AreNotEqual(testGame, testDBGame);
            Assert.AreNotEqual(testSchool, testGame);
            Assert.AreNotEqual(testEvent, testGame);
            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBGame", "tt", TestTime, TestTime, null, null, "Game", "*****@*****.**"));
            Assert.IsTrue(CalendarEventAdministration.Agenda.Contains(testDBGame));

            try
            {
                CalendarEventAdministration.AddCalendarEvent("testDBGame", "t", TestTime, TestTime, null, null, "Game", "*****@*****.**");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment already exist in agenda");
            }

            CollectionAssert.AllItemsAreUnique(CalendarEventAdministration.Agenda);
        }
        public void Test_DeleteCalenderEvent()
        {
            CalendarEvent testEvent = new CalendarEvent("testEvent", "t", TestTime, TestTime, "");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testEvent", "t", TestTime, TestTime, null, null, null, ""));

            Assert.IsTrue(CalendarEventAdministration.RemoveCalendarEvent(testEvent));

            try
            {
                CalendarEventAdministration.RemoveCalendarEvent(testEvent);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment doesn't exist in agenda");
            }

            CalendarEvent testDBEvent = new CalendarEvent("testDBDeleteEvent", "tt", TestTime, TestTime, "*****@*****.**");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBDeleteEvent", "tt", TestTime, TestTime, null, null, null, "*****@*****.**"));

            Assert.IsTrue(CalendarEventAdministration.RemoveCalendarEvent(testDBEvent));

            try
            {
                CalendarEventAdministration.RemoveCalendarEvent(testDBEvent);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment doesn't exist in agenda");
            }

            SchoolEvent testSchool = new SchoolEvent("testSchool", "t", TestTime, TestTime, "unit", "test", "");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testSchool", "t", TestTime, TestTime, "unit", "test", null, ""));

            Assert.IsTrue(CalendarEventAdministration.RemoveCalendarEvent(testSchool));

            try
            {
                CalendarEventAdministration.RemoveCalendarEvent(testSchool);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment doesn't exist in agenda");
            }

            SchoolEvent testDBSchool = new SchoolEvent("testDBDeleteSchool", "tt", TestTime, TestTime, "unit", "test", "*****@*****.**");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBDeleteSchool", "tt", TestTime, TestTime, "unit", "test", null, "*****@*****.**"));

            Assert.IsTrue(CalendarEventAdministration.RemoveCalendarEvent(testDBSchool));

            try
            {
                CalendarEventAdministration.RemoveCalendarEvent(testDBSchool);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment doesn't exist in agenda");
            }

            GameEvent testGame = new GameEvent("testGame", "t", TestTime, TestTime, "Game", "");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testGame", "t", TestTime, TestTime, null, null, "Game", ""));

            Assert.IsTrue(CalendarEventAdministration.RemoveCalendarEvent(testGame));

            try
            {
                CalendarEventAdministration.RemoveCalendarEvent(testGame);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment doesn't exist in agenda");
            }

            GameEvent testDBGame = new GameEvent("testDBDeleteGame", "tt", TestTime, TestTime, "Game", "*****@*****.**");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBDeleteGame", "tt", TestTime, TestTime, null, null, "Game", "*****@*****.**"));

            Assert.IsTrue(CalendarEventAdministration.RemoveCalendarEvent(testDBGame));

            try
            {
                CalendarEventAdministration.RemoveCalendarEvent(testDBGame);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "Appiontment doesn't exist in agenda");
            }
        }
        public void Test_UpdateCalenderEvent()
        {
            CalendarEventAdministration.Agenda.Clear();

            CalendarEvent testEvent = new CalendarEvent("testEvent", "t", TestTime, TestTime, "");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testEvent", "t", TestTime, TestTime, null, null, null, ""));

            Assert.IsTrue(CalendarEventAdministration.ChangeCalendarEvent(testEvent, "This is to test the update Event", "t t t t t ", TestTime, TestTime, null, null, null));

            try
            {
                CalendarEventAdministration.ChangeCalendarEvent(testEvent, "This is to test the update Event", "t t t t t ", TestTime, TestTime, null, null, null);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "The old appointment doesn't exist in the agenda");
            }

            CalendarEvent testDBEvent = new CalendarEvent("testDBUpdateEvent", "tt", TestTime, TestTime, "*****@*****.**");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBUpdateEvent", "tt", TestTime, TestTime, null, null, null, "*****@*****.**"));

            Assert.IsTrue(CalendarEventAdministration.ChangeCalendarEvent(testDBEvent, "This is to test the update database Event",
                                                                          "t t t ", TestTime, TestTime, null, null, null), "a");

            try
            {
                CalendarEventAdministration.ChangeCalendarEvent(testDBEvent, "This is to test the update database Event",
                                                                "t t t ", TestTime, TestTime, null, null, null);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "The old appointment doesn't exist in the agenda");
            }

            SchoolEvent testSchool = new SchoolEvent("testSchool", "t", TestTime, TestTime, "unit", "test", "");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testSchool", "t", TestTime, TestTime, "unit", "test", null, ""));

            Assert.IsTrue(CalendarEventAdministration.ChangeCalendarEvent(testSchool, "This is to test the update Event for school", "tt", TestTime, TestTime, "unit", "test", null));

            try
            {
                CalendarEventAdministration.ChangeCalendarEvent(testSchool, "This is to test the update Event for school", "tt", TestTime, TestTime, "unit", "test", null);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "The old appointment doesn't exist in the agenda");
            }

            SchoolEvent testDBSchool = new SchoolEvent("testDBUpdateSchool", "tt", TestTime, TestTime, "unit", "test", "*****@*****.**");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBUpdateSchool", "tt", TestTime, TestTime, "unit", "test", null, "*****@*****.**"));

            Assert.IsTrue(CalendarEventAdministration.ChangeCalendarEvent(testDBSchool, "This is to test the update database school Event",
                                                                          "t t t ", TestTime, TestTime, "unit test", "unit test", null), "b");

            try
            {
                CalendarEventAdministration.ChangeCalendarEvent(testDBSchool, "This is to test the update database school Event",
                                                                "t t t ", TestTime, TestTime, "unit test", "unit test", null);
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "The old appointment doesn't exist in the agenda");
            }

            GameEvent testGame = new GameEvent("testGame", "t", TestTime, TestTime, "Game", "");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testGame", "t", TestTime, TestTime, null, null, "Game", ""));

            Assert.IsTrue(CalendarEventAdministration.ChangeCalendarEvent(testGame, "This is to test the update Event for Game", "qwertyujnbvfrtyui", TestTime, TestTime, null, null, "Game"));

            try
            {
                CalendarEventAdministration.ChangeCalendarEvent(testGame, "This is to test the update Event for Game", "qwertyujnbvfrtyui", TestTime, TestTime, null, null, "Game");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "The old appointment doesn't exist in the agenda");
            }

            GameEvent testDBGame = new GameEvent("testDBUpdateGame", "tt", TestTime, TestTime, "Game", "*****@*****.**");

            Assert.IsTrue(CalendarEventAdministration.AddCalendarEvent("testDBUpdateGame", "tt", TestTime, TestTime, null, null, "Game", "*****@*****.**"));

            Assert.IsTrue(CalendarEventAdministration.ChangeCalendarEvent(testDBGame, "This is to test the update Event for Game in database", "test", TestTime, TestTime, null, null, "Game"), "c");

            try
            {
                CalendarEventAdministration.ChangeCalendarEvent(testDBGame, "This is to test the update Event for Game in database", "test", TestTime, TestTime, null, null, "Game");
            }
            catch (Exception exception)
            {
                Assert.IsTrue(exception is PlannerExceptions);
                Assert.AreEqual(exception.Message, "The old appointment doesn't exist in the agenda");
            }

            CollectionAssert.AllItemsAreUnique(CalendarEventAdministration.Agenda);
        }
 [HttpDelete] /*POSTMAN OK*/
 public IActionResult Delete([FromBody] SchoolEvent schoolEvent)
 {
     _eventRepo.Delete(schoolEvent);
     return(Ok());
 }
Example #16
0
        protected override void Seed(GakuenContext context)
        {
            Product product1 = context.Products.Add(new Product
            {
                Name  = "Weekend",
                Info  = "Være til connen alle dagene i weekenden",
                Price = 390
            });

            List <Product> products = new List <Product>();

            products.Add(product1);



            OrderList orderList1 = context.OrderLists.Add(new OrderList
            {
                ItemsList      = products,
                PaidStringCode = "123abc"
            });
            var orderLists = new List <OrderList> {
                orderList1
            };
            Address address1 = context.Addresses.Add(new Address
            {
                Country = "Denmark",
                Street1 = "Street 5",
                Town    = "Esbjerg",
                ZipCode = "6700"
            });

            var schedule1 = context.Schedules.Add(new Schedule
            {
                Day      = Schedule.Days.Fredag,
                DateTime = DateTime.Now
                           //SchoolEvents = eventList
            });


            SchoolEvent schoolEvent1 = context.SchoolEvents.Add(new SchoolEvent
            {
                Minuttes = 40,
                Name     = "Japansk",
                Schedule = schedule1
            });
            var eventList = new List <SchoolEvent> {
                schoolEvent1
            };



            var user1 = context.Users.Add(new User
            {
                FirstName     = "Torben",
                LastName      = "Sonson",
                ConfirmedUser = true,
                Address       = address1,
                Email         = "*****@*****.**",
                PhoneNr       = "25252525",
                Password      = "******",
                UserName      = "******",
                Position      = User.Positions.Student,
                OrderLists    = orderLists,
                SchoolEvents  = eventList,
                Birthday      = DateTime.Now,
                IsAdmin       = false
            });

            var user2 = context.Users.Add(new User
            {
                FirstName     = "Morten",
                LastName      = "Sonson",
                ConfirmedUser = true,
                Address       = null,
                Email         = "*****@*****.**",
                PhoneNr       = "25252525",
                Password      = "******",
                UserName      = "******",
                Position      = User.Positions.Teacher,
                OrderLists    = null,
                SchoolEvents  = eventList,
                Birthday      = DateTime.Now,
                IsAdmin       = true
            });
            var userList = new List <User> {
                user1, user2
            };



            //byte[] imgBytes;
            //var loadedImage =
            //    Image.FromFile(@"C:\Users\Martin\Desktop\Avatar\1532512.jpg");

            //using (MemoryStream ms = new MemoryStream())
            //{
            //    loadedImage.Save(ms, ImageFormat.Jpeg);
            //    imgBytes = ms.ToArray();
            //}


            ImageToHost imageToHost1 = context.Images.Add(new ImageToHost
            {
                //Bytes = imgBytes,
                ImagePath = "http://images5.fanpop.com/image/answers/2128000/2128709_1320189934337.28res_354_458.jpg",
                ImageName = "Mad Girl"
            });

            ImageToHost imageToHost2 = context.Images.Add(new ImageToHost
            {
                ImagePath = "http://www.animeplus.tv/images/series/small/13.jpg",
                ImageName = "Cheering"
            });

            ImageToHost imageToHost3 = context.Images.Add(new ImageToHost
            {
                ImagePath = "https://myanimelist.cdn-dena.com/images/anime/12/70143.jpg",
                ImageName = "Hot Men 4 Hot Day"
            });

            ImageToHost imageToHost4 = context.Images.Add(new ImageToHost
            {
                ImagePath = "https://scontent-arn2-1.xx.fbcdn.net/v/t34.0-12/15645256_1161155567270931_1187945786_n.png?oh=ebf1fe1f13f4ac0dc03f90fa72db4622&oe=585A363B",
                ImageName = "School Body"
            });

            VideoToHost videoToHost = context.VideoToHosts.Add(new VideoToHost
            {
                VideoPath = "https://www.youtube.com/watch?v=0yJn-5hpU94",
                VideoName = "Anime Song"
            });

            NewsMessage newsMessage1 = context.NewsMessages.Add(new NewsMessage
            {
                Title       = "Open",
                Body        = "Så er butikken open for alle, glæder os til at se jer",
                ImageToHost = imageToHost1,
                VideoToHost = videoToHost
            });

            NewsMessage newsMessage2 = context.NewsMessages.Add(new NewsMessage
            {
                Title = "Second News",
                Body  =
                    "Spicy jalapeno drumstick pig kevin doner strip steak. Kielbasa turducken spare ribs flank. Frankfurter doner meatball shankle pork belly burgdoggen. Filet mignon picanha biltong, landjaeger pig capicola kevin jowl pork corned beef turkey tri-tip short loin. Frankfurter shankle jowl, boudin shoulder sausage salami short ribs biltong alcatra.",
                ImageToHost = imageToHost2
            });
            NewsMessage newsMessage3 = context.NewsMessages.Add(new NewsMessage
            {
                Title = "More News",
                Body  =
                    "Does your lorem ipsum text long for something a little meatier ? Give our generator a try… it’s tasty!",
                ImageToHost = imageToHost3
            }); NewsMessage newsMessage4 = context.NewsMessages.Add(new NewsMessage
            {
                Title       = "New Line News",
                Body        = "Sirloin boudin short ribs, ham hock jerky shoulder t-bone brisket cupim strip steak ball tip pancetta spare ribs chuck. Ball tip drumstick beef ribs kevin tongue pastrami pig meatloaf. Kielbasa turducken capicola meatball drumstick venison burgdoggen landjaeger tail. Leberkas burgdoggen ground round, boudin shoulder bacon filet mignon corned beef. Boudin flank beef ribs chicken ball tip burgdoggen swine, bacon pastrami. Alcatra burgdoggen ribeye picanha beef ribs, beef biltong ham hock hamburger spare ribs meatloaf ball tip prosciutto boudin tongue.",
                ImageToHost = imageToHost4
            });

            EventMessage eventMessage1 = context.EventMessages.Add(new EventMessage
            {
                Title       = "Glade dage",
                Body        = "Så er der dømt glade dage til jer alle",
                ImageToHost = imageToHost1
            });

            base.Seed(context);
        }