public ActionResult CreateStudy(Study_Material study_Material, HttpPostedFileBase fileUpload) { using (var ms = new MemoryStream()) { fileUpload.InputStream.CopyTo(ms); study_Material.File = ms.ToArray(); } if (ModelState.IsValid) { db.Study_Materials.Add(study_Material); db.SaveChanges(); return(RedirectToAction("Study_Material")); } return(View(study_Material)); }
public ActionResult Create([Bind(Include = "ID,announcementText,announcementDate,expiresAt")] Announcement announcement) { if (Session["userName"] != null) { if (ModelState.IsValid) { db.Announcements.Add(announcement); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(announcement)); } else { return(RedirectToAction("Logout", "Admin")); } }
public ActionResult Create([Bind(Include = "ID,cyberAlertText,cyberAlertDate,expiresAt")] cyberAlert cyberAlert) { if (Session["userName"] != null) { if (ModelState.IsValid) { db.cyberAlerts.Add(cyberAlert); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cyberAlert)); } else { return(RedirectToAction("Logout", "Admin")); } }
public ActionResult Create([Bind(Include = "ID,lectureTopic,speakerName,location,date")] Lecture lecture) { if (Session["userName"] != null) { if (ModelState.IsValid) { db.Lectures.Add(lecture); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lecture)); } else { return(RedirectToAction("Logout", "Admin")); } }
public ActionResult Create([Bind(Include = "ID,quoteText,expiresAt")] Quote quote) { if (Session["userName"] != null) { if (ModelState.IsValid) { db.Quotes.Add(quote); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(quote)); } else { return(RedirectToAction("Logout", "Admin")); } }
public ActionResult Create(Synopsis synopsis, HttpPostedFileBase fileUpload) { if (Session["userName"] != null) { using (var ms = new MemoryStream()) { fileUpload.InputStream.CopyTo(ms); synopsis.File = ms.ToArray(); } if (ModelState.IsValid) { db.Synopsis.Add(synopsis); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(synopsis)); } else { return(RedirectToAction("Logout", "Admin")); } }
public ActionResult Create(Commandant commandant, HttpPostedFileBase ImageFile) { if (Session["userName"] != null) { using (var ms = new MemoryStream()) { ImageFile.InputStream.CopyTo(ms); commandant.Image = ms.ToArray(); } if (ModelState.IsValid) { db.Commandants.Add(commandant); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(commandant)); } else { return(RedirectToAction("Logout", "Admin")); } }
public ActionResult Create(Study_Material study_Material, HttpPostedFileBase fileUpload) { if (Session["userName"] != null) { //var extension = Path.GetExtension(fileUpload.FileName); using (var ms = new MemoryStream()) { fileUpload.InputStream.CopyTo(ms); study_Material.File = ms.ToArray(); } if (ModelState.IsValid) { db.Study_Materials.Add(study_Material); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(study_Material)); } else { return(RedirectToAction("Logout", "Admin")); } }