public ActionResult Create([Bind(Include = "madeBy_FK, course_FK, title, academicYear, academicPeriod, status")]Syllabu newSyllabus) { if (ModelState.IsValid) { sm.Syllabus.Add(newSyllabus); sm.SaveChanges(); return RedirectToAction("Creation"); } return View("Creation"); }
// GET: Chairman public ActionResult ViewAllChSyllabus() { Syllabus_ManagementEntities4 sm = new Syllabus_ManagementEntities4(); Syllabu s = new Syllabu(); var syllabusList = (from u in sm.Syllabus select u); ViewData["ListofSyllabus_C"] = syllabusList.ToList(); return(View()); }
public ActionResult ViewAllTSyllabus() { // Get all syllabus of all handled courses here. Syllabu s = new Syllabu(); var syllabusList = (from u in sm.Syllabus where u.madeBy_FK == 1 select u); ViewData["ListofSyllabus"] = syllabusList.ToList(); return View(); }
// GET: Syllabus/Delete/5 public async Task <ActionResult> Delete(int?id) { if (Session["AJ"] == null) { return(RedirectToAction("Index", "Home")); } Syllabu syllabu = await db.Syllabus.FindAsync(id); db.Syllabus.Remove(syllabu); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult ClassroomPolicy() { // Get all classroom policies this courses here. //int syllabusID = Convert.ToInt32(Request.QueryString["SyllabusID"]); int syllabusID = 1; Syllabu s = new Syllabu(); var policyList = (from u in sm.Class_Policy where u.syllabus_FK == syllabusID select u); ViewData["ListofPolicies"] = policyList.ToList(); ViewBag.syllabusID = syllabusID; return View(); }
// GET: Syllabus/Edit/5 public async Task <ActionResult> Edit(int?id) { if (Session["AJ"] == null) { return(RedirectToAction("Index", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Syllabu syllabu = await db.Syllabus.FindAsync(id); if (syllabu == null) { return(HttpNotFound()); } return(View(syllabu)); }
public async Task <ActionResult> Create(Syllabu syllabu, HttpPostedFileBase file) { try { if (file != null && file.ContentLength > 0) { var myUniqueFileName = DateTime.Now.Ticks + ".jpg"; string physicalPath = Server.MapPath("~/img/" + myUniqueFileName); file.SaveAs(physicalPath); syllabu.Sy_Img = myUniqueFileName; } db.Syllabus.Add(syllabu); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } catch (Exception) { return(View(syllabu)); } }
public async Task <ActionResult> Edit(Syllabu syllabu, HttpPostedFileBase file) { if (ModelState.IsValid) { var recordToUpdate = db.Syllabus.AsNoTracking().Single(x => x.Sy_ID == syllabu.Sy_ID); if (file != null && file.ContentLength > 0) { var myUniqueFileName = DateTime.Now.Ticks + ".jpg"; string physicalPath = Server.MapPath("~/img/" + myUniqueFileName); file.SaveAs(physicalPath); syllabu.Sy_Img = myUniqueFileName; } else { syllabu.Sy_Img = recordToUpdate.Sy_Img; } db.Entry(syllabu).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(syllabu)); }