Beispiel #1
0
        public IHttpActionResult PutStudent(int id, Student student)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(student).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "ID,Priority,Date,Time,Title,Department,CourseID,Notes")] Homework homework)
        {
            if (ModelState.IsValid)
            {
                db.Homework.Add(homework);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(homework));
        }
Beispiel #3
0
        private void studentBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            Validate();

            ctx.SaveChanges();

            studentDataGridView.Refresh();
        }