Example #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            FullCourse fullCourse = await db.FullCourses.FindAsync(id);

            db.FullCourses.Remove(fullCourse);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Cid,Name,Cover")] FullCourse fullCourse, HttpPostedFileBase file, Helper help)
        {
            if (ModelState.IsValid)
            {
                fullCourse.Cover = file != null?help.uploadfile(file) : img;

                db.Entry(fullCourse).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(fullCourse));
        }
Example #3
0
        public async Task <ActionResult> Create([Bind(Include = "Cid,Name,Cover")] FullCourse fullCourse, HttpPostedFileBase file, Helper help)
        {
            if (ModelState.IsValid)
            {
                fullCourse.Cover = help.uploadfile(file);
                db.FullCourses.Add(fullCourse);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(fullCourse));
        }
Example #4
0
        // GET: Auth/FullCourses/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FullCourse fullCourse = await db.FullCourses.FindAsync(id);

            if (fullCourse == null)
            {
                return(HttpNotFound());
            }
            return(View(fullCourse));
        }