public ActionResult Create([Bind(Include = "CustomerID,Name,SurName,BirthDay,Email,ProfilePhoto,PhoneNumber,Adres")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
        public ActionResult Create([Bind(Include = "ProductID,ProdName,ProdNo,ProdKind,prodImage,ProdPrice")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(product));
        }
        public ActionResult Create([Bind(Include = "OrderID,CustomerID,ProductID")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Name", order.CustomerID);
            ViewBag.ProductID  = new SelectList(db.Products, "ProductID", "ProdName", order.ProductID);
            return(View(order));
        }
        public int SaveGrade()
        {
            using (var stream = new MemoryStream())
            {
                var request = HttpContext.Current.Request;
                request.InputStream.Seek(0, SeekOrigin.Begin);
                request.InputStream.CopyTo(stream);
                var dataStr = Encoding.UTF8.GetString(stream.ToArray());
                var data    = (dynamic)JsonConvert.DeserializeObject(dataStr);
                using (var db = new WebProjectEntities())
                {
                    var d            = data.data;
                    int studentID    = Convert.ToInt32(d["studentID"]);
                    int assignmentID = Convert.ToInt32(d["assignmentID"]);
                    int grade1       = Convert.ToInt32(d["grade1"]);
                    //var lecturer = id == 0 ? new lecturer() : db.lecturers.Where(i => i.lecturerID == id).FirstOrDefault();
                    var gradeEntry = db.grades.Where(ge => ge.studentID == studentID && ge.assignmentID == assignmentID).FirstOrDefault();
                    gradeEntry.grade1 = grade1;
                    //user.Password = Convert.ToString(d["Password"]);
                    //user.Address = Convert.ToString(d["Address"]);

                    //if (assignmentID == 0) db.lecturers.Add(lecturer);
                    db.SaveChanges();

                    return(gradeEntry.index);
                }
            }
        }