Exemple #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Сourse Course = await db.Сourse.FindAsync(id);

            db.Сourse.Remove(Course);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,TeacherID")] Сourse Course)
        {
            if (ModelState.IsValid)
            {
                db.Entry(Course).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.TeacherID = new SelectList(db.Teacher, "Id", "Name", Course.TeacherID);
            return(View(Course));
        }
Exemple #3
0
        // GET: Сourse/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Сourse Course = await db.Сourse.FindAsync(id);

            if (Course == null)
            {
                return(HttpNotFound());
            }
            return(View(Course));
        }
Exemple #4
0
        // GET: Сourse/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Сourse Course = await db.Сourse.FindAsync(id);

            if (Course == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TeacherID = new SelectList(db.Teacher, "Id", "Name", Course.TeacherID);
            return(View(Course));
        }