public void Patch(uint id, [FromBody] StudentProgram studentProgram)
        {
            var toModify = GetStudentProgram(id);

            toModify.TeamName = studentProgram.TeamName;
            toModify.Src      = studentProgram.Src;
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            StudentProgram studentProgram = new StudentProgram();

            studentProgram.ProgramID          = Convert.ToInt32(txtProgramName.Tag);
            studentProgram.ProgramName        = txtProgramName.Text;
            studentProgram.DegreeID           = Convert.ToInt64(cmbStudentDegree.SelectedValue);
            studentProgram.CreatedByID        = Convert.ToInt32(this.Tag);
            studentProgram.CreatedDateTime    = System.DateTime.Now;
            studentProgram.LastUpdateID       = Convert.ToInt32(this.Tag);
            studentProgram.LastUpdateDateTime = System.DateTime.Now;
            studentProgram.IsEnabled          = chkIsEnabled.Checked;
            studentProgram.Remarks            = txtProgramRemarks.Text;

            long degree_id = StudentProgramController.InsertUpdateStudentProgram(studentProgram);

            txtProgramName.Tag = degree_id;
            if (degree_id > 0)
            {
                SuccessMessage.SHowDialog("Record Entered Successfully");
                StudentProgramDataGridView.DataSource = studentPrograms;
            }
            else
            {
                ErrorMessage.SHowDialog("Record Not Entered Successfully Error!");
            }
        }
 ///<summary>
 ///下一个规划
 ///<para>Id:成功案列Id</para>
 /// </summary>
 public StudentProgram StudentNext(int Id)
 {
     try
     {
         StudentProgram infor = new StudentProgram();
         DataTable      dt1   = MySqlDB.GetDataTable("select MAX(StudentProgramID) from studentprogram", CommandType.Text, null);
         int            Sid   = (int)dt1.Rows[0][0];
         if (Id >= Sid)
         {
             infor.StudentProgramTitle = "已经是最后一章了";
             return(infor);
         }
         else
         {
             string           sql  = "select *  from studentprogram where StudentProgramID >@Id LIMIT 1";
             MySqlParameter[] para =
             {
                 new MySqlParameter("@Id", Id)
             };
             DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, para);
             infor.StudentProgramID    = (int)dt.Rows[0]["StudentProgramID"];
             infor.StudentProgramTitle = dt.Rows[0]["StudentProgramTitle"].ToString();
             Log4netHelper.WriteLog("日志报告");
             return(infor);
         }
     }
     catch (Exception ex)
     {
         Log4netHelper.WriteLog("错误报告", ex);
         return(null);
     }
 }
        ///<summary>
        ///规划详情
        ///<para>Id:规划ID</para>
        /// </summary>
        public StudentProgram StudentShow(int Id)
        {
            try
            {
                string sql1 = "update `studentprogram` set ReadCount=ReadCount+1 where StudentProgramID=" + Id + "";
                MySqlDB.nonquery(sql1, CommandType.Text, null);
                string           sql  = "select * from studentprogram left join country on studentprogram.CountryID=country.CountryID left join educationtype on studentprogram.EducationID=educationtype.EducationID where StudentProgramID = @Id";
                MySqlParameter[] para =
                {
                    new MySqlParameter("@Id", Id)
                };
                DataTable      dt      = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                StudentProgram student = new StudentProgram();
                student.Author = dt.Rows[0]["Author"].ToString();
                //student.Image = Convert.ToBase64String((byte[])dt.Rows[0]["Image"]);
                student.CountryName           = dt.Rows[0]["CountryName"].ToString();
                student.EducationName         = dt.Rows[0]["EducationName"].ToString();
                student.ReadCount             = (int)dt.Rows[0]["ReadCount"];
                student.StudentProgramContent = dt.Rows[0]["StudentProgramContent"].ToString();
                student.StudentProgramTitle   = dt.Rows[0]["StudentProgramTitle"].ToString();
                student.Source         = dt.Rows[0]["Source"].ToString();
                student.StudentKeyWord = dt.Rows[0]["StudentKeyWord"].ToString();
                student.StudentProfile = dt.Rows[0]["StudentProfile"].ToString();
                student.Imageurl       = dt.Rows[0]["Imageurl"].ToString();

                Log4netHelper.WriteLog("日志报告");
                return(student);
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误日志", ex);
                throw ex;
            }
        }
        ///<summary>
        ///上一个规划
        ///<para>Id:成功案列Id</para>
        /// </summary>
        public StudentProgram StudentPrev(int Id)
        {
            try
            {
                StudentProgram stu = new StudentProgram();
                DataTable      dt1 = MySqlDB.GetDataTable("select min(StudentProgramID) from studentprogram", CommandType.Text, null);
                int            Sid = (int)dt1.Rows[0][0];

                if (Id == Sid)
                {
                    stu.StudentProgramTitle = "已是第一章了";
                    return(stu);
                }
                else
                {
                    string           sql  = "select *  from studentprogram where StudentProgramID <@Id order by StudentProgramID desc limit 1";
                    MySqlParameter[] para =
                    {
                        new MySqlParameter("@Id", Id)
                    };

                    DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, para);
                    stu.StudentProgramID    = (int)dt.Rows[0]["StudentProgramID"];
                    stu.StudentProgramTitle = dt.Rows[0]["StudentProgramTitle"].ToString();
                    Log4netHelper.WriteLog("日志报告");
                    return(stu);
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteLog("错误报告", ex);
                throw ex;
            }
        }
Example #6
0
    }     //end function

    public StudentProgram StudentProgramSelectByID(int intProgramID)
    {
        try
        {
            string sp_name = "StudentProgramSelectByID";
            comStudentProgram.Parameters.AddWithValue("ProgramID", intProgramID);
            ConnectAndExecute(sp_name); //no parameter will send to stored procedure
            if (dsStudentProgram.Tables[0].Rows.Count == 1)
            {
                DataRow        drStudentProgram  = dsStudentProgram.Tables[0].Rows[0];
                StudentProgram objStudentProgram = new StudentProgram();
                objStudentProgram.ProgramID          = Convert.ToInt64(drStudentProgram["ProgramID"]);
                objStudentProgram.ProgramName        = Convert.ToString(drStudentProgram["ProgramName"]);
                objStudentProgram.DegreeID           = Convert.ToInt64(drStudentProgram["DegreeID"]);
                objStudentProgram.CreatedByID        = Convert.ToInt64(drStudentProgram["CreatedByID"]);
                objStudentProgram.CreatedDateTime    = Convert.ToDateTime(drStudentProgram["CreatedDateTime"]);
                objStudentProgram.LastUpdateID       = Convert.ToInt64(drStudentProgram["LastUpdateID"]);
                objStudentProgram.LastUpdateDateTime = Convert.ToDateTime(drStudentProgram["LastUpdateDateTime"]);
                objStudentProgram.IsEnabled          = Convert.ToBoolean(drStudentProgram["IsEnabled"]);
                objStudentProgram.Remarks            = Convert.ToString(drStudentProgram["Remarks"]);

                return(objStudentProgram);
            }
            return(null);
        }
        catch (Exception ex)
        {
            SetError(ex.Message);
            return(null);
        } //end try
    }     //end function
Example #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            StudentProgram studentProgram = db.StudentProgram.Find(id);

            db.StudentProgram.Remove(studentProgram);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #8
0
        public ActionResult Save(StudentProgram studentProgram)
        {
            _context.StudentPrograms.Add(studentProgram.StudentPrograms);

            _context.SaveChanges();



            return(RedirectToAction("Index", "Program"));
        }
Example #9
0
        public ActionResult Registration()
        {
            var Programs   = _context.Programs.ToList();
            var viewModels = new StudentProgram()
            {
                StudentPrograms = new Student_Program(),
                Program         = Programs
            };

            return(View("RegistrationForm", viewModels));
        }
Example #10
0
 public ActionResult Edit([Bind(Include = "StudentProgramID,StudentID,ProgramsID")] StudentProgram studentProgram)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentProgram).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProgramsID = new SelectList(db.Programs, "ProgramsID", "ProgramName", studentProgram.ProgramsID);
     ViewBag.StudentID  = new SelectList(db.Student, "StudentID", "FirstName", studentProgram.StudentID);
     return(View(studentProgram));
 }
 public ActionResult Edit(StudentProgram program)
 {
     if (ModelState.IsValid)
     {
         studprogRepository.Update(program);
         studprogRepository.Save();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(program));
     }
 }
Example #12
0
        public ActionResult Create([Bind(Include = "StudentProgramId,StudentId,ProgramId,Status")] StudentProgram studentProgram)
        {
            if (ModelState.IsValid)
            {
                db.StudentProgram.Add(studentProgram);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProgramId = new SelectList(db.Program, "ProgramId", "Name", studentProgram.ProgramId);
            ViewBag.StudentId = new SelectList(db.Student, "StudentId", "FirstName", studentProgram.StudentId);
            return(View(studentProgram));
        }
Example #13
0
        // GET: StudentPrograms/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentProgram studentProgram = db.StudentProgram.Find(id);

            if (studentProgram == null)
            {
                return(HttpNotFound());
            }
            return(View(studentProgram));
        }
Example #14
0
        // GET: StudentPrograms/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentProgram studentProgram = db.StudentProgram.Find(id);

            if (studentProgram == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProgramsID = new SelectList(db.Programs, "ProgramsID", "ProgramName", studentProgram.ProgramsID);
            ViewBag.StudentID  = new SelectList(db.Student, "StudentID", "FirstName", studentProgram.StudentID);
            return(View(studentProgram));
        }
Example #15
0
    ///////////////////////////////////////////////////////////////////////////////////////////

    //Private Methods///////////////////////////////////////////////////////////////////////////

    //DB to Model//
    private void GenerateModelList()
    {
        StudentProgramList.Clear();
        foreach (DataRow drStudentProgram in dsStudentProgram.Tables[0].Rows)
        {
            StudentProgram objStudentProgram = new StudentProgram();
            objStudentProgram.ProgramID          = Convert.ToInt64(drStudentProgram["ProgramID"]);
            objStudentProgram.ProgramName        = Convert.ToString(drStudentProgram["ProgramName"]);
            objStudentProgram.DegreeID           = Convert.ToInt64(drStudentProgram["DegreeID"]);
            objStudentProgram.CreatedByID        = Convert.ToInt64(drStudentProgram["CreatedByID"]);
            objStudentProgram.CreatedDateTime    = Convert.ToDateTime(drStudentProgram["CreatedDateTime"]);
            objStudentProgram.LastUpdateID       = Convert.ToInt64(drStudentProgram["LastUpdateID"]);
            objStudentProgram.LastUpdateDateTime = Convert.ToDateTime(drStudentProgram["LastUpdateDateTime"]);
            objStudentProgram.IsEnabled          = Convert.ToBoolean(drStudentProgram["IsEnabled"]);
            objStudentProgram.Remarks            = Convert.ToString(drStudentProgram["Remarks"]);

            StudentProgramList.Add(objStudentProgram);
        }
    }
        public ActionResult <StudentProgram> selectTopProgram()
        {
            if (0 == Interlocked.CompareExchange(ref Locked, 1, 0))
            {
                if (studentPrograms.Count == 0)
                {
                    HttpContext.Response.StatusCode = 410;
                    return(null);
                }
                StudentProgram studentProgram = studentPrograms.First();
                var            strCmdText     = $"trash.txt {studentProgram.Id} {studentProgram.TeamName} {studentProgram.Src}";
                var            process        = Process.Start(@"C:\Users\Ian\source\repos\Async String\Async String\bin\Debug\netcoreapp3.1\Async String.exe", strCmdText);
                process.WaitForExit();

                Locked = 0;
                return(Delete(studentProgram.Id));
            }
            HttpContext.Response.StatusCode = 423;
            return(null);
        }
Example #17
0
        public void Delete(object Id)
        {
            StudentProgram getObjById = dbSet.Find(Id);

            dbSet.Remove(getObjById);
        }
Example #18
0
 public void Update(StudentProgram obj)
 {
     db.Entry(obj).State = EntityState.Modified;
 }
Example #19
0
 public void Insert(StudentProgram obj)
 {
     dbSet.Add(obj);
 }
Example #20
0
    public static Int64 InsertUpdateStudentProgram(StudentProgram objIUStudentProgram)
    {
        Int64 new_id = objIUStudentProgram.InsertUpdateStudentProgram();

        return(new_id);
    }
Example #21
0
        private void Daly_Tick(object sender, EventArgs e)
        {
            Daly.Stop();
            List <StudentDegree> studentDegrees = new List <StudentDegree>();

            studentDegrees      = StudentDegreeController.StudentDegreeSelectAll();
            lblTotalDegree.Text = studentDegrees.Count.ToString();
            StudentDegree studentDegree = new StudentDegree();

            studentDegrees = studentDegree.StudentDegreeSelectAll();
            List <StudentProgram> studentPrograms = new List <StudentProgram>();
            StudentProgram        studentProgram  = new StudentProgram();

            studentPrograms      = studentProgram.StudentProgramSelectAll();
            lblProgramTotal.Text = studentPrograms.Count.ToString();
            List <CollageAdmin> collageAdmins = CollageAdminController.CollageAdminSelectAll();

            lblTotalAdmin.Text = collageAdmins.Count.ToString();
            List <StudentPersonalInfo> studentPersonalInfos = StudentPersonalInfoController.StudentPersonalInfoSelectAll();

            lblTotalStudent.Text = studentPersonalInfos.Count.ToString();
            List <StudentSections> studentSections = StudentSectionsController.StudentSectionsSelectAll();

            lblTotalSection.Text = studentSections.Count.ToString();
            Bunifu.DataViz.Data      data      = new Bunifu.DataViz.Data();
            Bunifu.DataViz.DataPoint dataPoint = new Bunifu.DataViz.DataPoint(Bunifu.DataViz.BunifuCharts._type.column);
            Random r = new Random();

            dataPoint.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint.addLabely("Users", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint.addLabely("Users", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());


            data.addData(dataPoint);
            CollumChart.Render(data);
            Bunifu.DataViz.Data      data1      = new Bunifu.DataViz.Data();
            Bunifu.DataViz.DataPoint dataPoint2 = new Bunifu.DataViz.DataPoint(Bunifu.DataViz.BunifuCharts._type.pie);

            dataPoint2.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint2.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint2.addLabely("Users", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint2.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint2.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint2.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint2.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint2.addLabely("Users", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint2.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint2.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());


            data1.addData(dataPoint2);
            bunifuCharts1.Render(data1);
            Bunifu.DataViz.Data data2 = new Bunifu.DataViz.Data();

            Bunifu.DataViz.DataPoint dataPoint3 = new Bunifu.DataViz.DataPoint(Bunifu.DataViz.BunifuCharts._type.spline);

            dataPoint3.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint3.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint3.addLabely("Users", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint3.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint3.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint3.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint3.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());

            dataPoint3.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint3.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());


            data2.addData(dataPoint3);
            bunifuCharts2.Render(data2);

            Bunifu.DataViz.Data data3 = new Bunifu.DataViz.Data();

            Bunifu.DataViz.DataPoint dataPoint4 = new Bunifu.DataViz.DataPoint(Bunifu.DataViz.BunifuCharts._type.area);

            dataPoint4.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint4.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint4.addLabely("Users", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint4.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint4.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint4.addLabely("Degrees", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint4.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());
            dataPoint4.addLabely("Program", r.Next(0, Convert.ToInt32(studentDegrees.Count.ToString())).ToString());
            dataPoint4.addLabely("Program", r.Next(0, Convert.ToInt32(studentPrograms.Count.ToString())).ToString());


            data3.addData(dataPoint4);
            bunifuCharts3.Render(data3);
        }
Example #22
0
        private void SeedUserWithProducts(StudentWebMarketDbContext context)
        {
            var user = new User
            {
                FirstName   = "John",
                LastName    = "Doe",
                Email       = "*****@*****.**",
                UserName    = "******",
                PhoneNumber = "50 645 177",
                //UserPhoto = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                //"C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/johndoe.jpg")),
                RegistrationDate = new DateTime(2018, 1, 1)
            };

            var school = new School
            {
                Name = "Kea"
            };

            user.Schools = school;

            var studPro = new StudentProgram
            {
                Name = "Computer Science"
            };

            user.StudentPrograms = studPro;

            var createdUser = context.Users
                              .Where(u => string.Compare(u.Email, user.Email, true) == 0)
                              .FirstOrDefault();

            if (createdUser == null)
            {
                this.userManager.Create(user, "123456");

                var product1 = new Product
                {
                    OriginalPrice = 2000,
                    SalePrice     = 800,
                    CreatedOn     = new DateTime(2018, 1, 10),
                    Year          = 2017,
                    Description   = "Android 4.4 Kit Kat OS, 1.2 GHz quad-core processor",
                    Name          = "Samsung Galaxy"
                };
                product1.Seller = user;

                var image = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/samsung-galaxy.jpg")),
                    FileExtension = "jpg"
                };
                product1.Image = image;

                var category = new Category
                {
                    Name = "Tablets",
                };
                product1.Category = category;

                var condition = new Condition
                {
                    Name = "Used - Like New"
                };
                product1.Condition = condition;

                var product2 = new Product
                {
                    OriginalPrice = 1200,
                    SalePrice     = 600,
                    CreatedOn     = new DateTime(2018, 2, 8),
                    Year          = 2016,
                    Description   = "Pad 7 ME170CX-A1-BK 7-Inch 16GB Tablet. Dual-Core Intel Atom Z2520 1.2GHz CPU",
                    Name          = "ASUS MeMO"
                };
                product2.Seller = user;

                var image2 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/asus-memo.jpg")),
                    FileExtension = "jpg"
                };
                product2.Category  = category;
                product2.Condition = condition;
                product2.Image     = image2;

                var product3 = new Product
                {
                    OriginalPrice = 3500,
                    SalePrice     = 1500,
                    CreatedOn     = new DateTime(2018, 3, 3),
                    Year          = 2018,
                    Description   = "This Certified Refurbished product is manufacturer refurbished, shows limited or no wear, and includes all original accessories plus a 90-day warranty",
                    Name          = "HP Pavilion 15-r030wm"
                };
                product3.Seller = user;

                var image3 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/hp-pavilion.jpg")),
                    FileExtension = "jpg"
                };
                product3.Image = image3;

                var category2 = new Category
                {
                    Name = "Laptops",
                };
                product3.Category = category2;

                var condition2 = new Condition
                {
                    Name = "Used - Very Good"
                };

                var product4 = new Product
                {
                    OriginalPrice = 4000,
                    SalePrice     = 2000,
                    CreatedOn     = new DateTime(2018, 3, 15),
                    Year          = 2017,
                    Description   = "Intel Celeron N2830 Processor, 15.6-Inch Screen, Intel HD Graphics",
                    Name          = "Dell Inspiron 15.6-Inch",
                };
                product4.Seller = user;

                var image4 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/dell-inspiron.jpg")),
                    FileExtension = "jpg"
                };
                product4.Image     = image4;
                product4.Category  = category2;
                product4.Condition = condition2;
                var product5 = new Product
                {
                    OriginalPrice = 3000,
                    SalePrice     = 1000,
                    CreatedOn     = new DateTime(2018, 1, 31),
                    Year          = 2017,
                    Description   = "13 MP Rear Facing BSI Camera / 5 MP Front Facing",
                    Name          = "HTC Desire 816"
                };
                product5.Seller = user;

                var image5 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/htc-desire.jpg")),
                    FileExtension = "jpg"
                };
                product5.Image = image5;

                var category3 = new Category
                {
                    Name = "Mobiles",
                };
                product5.Category = category3;

                var condition3 = new Condition
                {
                    Name = "Used - Acceptable"
                };
                product5.Condition = condition3;

                var product6 = new Product
                {
                    OriginalPrice = 2500,
                    SalePrice     = 1300,
                    CreatedOn     = new DateTime(2018, 2, 21),
                    Year          = 2017,
                    Description   = "T-Mobile Cell Phone 4G - White. 5MP Camera - Snap creative photos with built-in digital lenses",
                    Name          = "Nokia Lumia 521",
                };
                product6.Seller = user;

                var image6 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/nokia-lumia.jpg")),
                    FileExtension = "jpg"
                };



                var product7 = new Product
                {
                    OriginalPrice = 1500,
                    SalePrice     = 800,
                    CreatedOn     = new DateTime(2018, 5, 6),
                    Year          = 2017,
                    Description   = "Head First Java delivers a highly interactive, multisensory learning experience that lets new programmers pick up the fundamentals of the Java language quickly",
                    Name          = "Head First Java",
                };
                product7.Seller = user;
                var category4 = new Category
                {
                    Name = "Books",
                };
                product7.Category = category4;

                var image7 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/java.jpg")),
                    FileExtension = "jpg"
                };
                product7.Image     = image7;
                product7.Condition = condition2;

                var product8 = new Product
                {
                    OriginalPrice = 500,
                    SalePrice     = 300,
                    CreatedOn     = new DateTime(2018, 5, 10),
                    Year          = 2017,
                    Description   = "A full-color introduction to the basics of HTML and CSS",
                    Name          = "Pro HTML5 and CSS3",
                };
                product8.Seller = user;

                var image8 = new Image
                {
                    Content = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                             "C:/Users/Navn/Source/Repos/StudentWebMarket/StudentWebMarket.Data/Migrations/Images/aspnet.jpg")),
                    FileExtension = "jpg"
                };
                product8.Image     = image8;
                product8.Condition = condition;
                product8.Category  = category4;
                product6.Image     = image6;
                product6.Category  = category3;
                product6.Condition = condition3;
                product3.Condition = condition2;

                context.Products.Add(product1);
                context.Products.Add(product2);
                context.Products.Add(product3);
                context.Products.Add(product4);
                context.Products.Add(product5);
                context.Products.Add(product6);
                context.Products.Add(product7);
                context.Products.Add(product8);
                context.SaveChanges();
            }
        }
 public void Post([FromBody] StudentProgram studentProgram)
 {
     studentPrograms.Enqueue(studentProgram);
 }