public ActionResult UploadSongs(FileDataVM model) { if (!ModelState.IsValid) { return(View(model)); } byte[] uploadedFile = new byte[model.File.InputStream.Length]; model.File.InputStream.Read(uploadedFile, 0, uploadedFile.Length); // now you could pass the byte array to your model and store wherever // you intended to store it var song = db.Songs.Find(Session["ID"]); if (song == null) { return(HttpNotFound()); } song.Song_File = uploadedFile; db.Entry(song).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult UploadFiles(string id, FileDataVM model) { if (!ModelState.IsValid) { return(View(model)); } byte[] uploadedFile = new byte[model.File.InputStream.Length]; model.File.InputStream.Read(uploadedFile, 0, uploadedFile.Length); // now you could pass the byte array to your model and store wherever // you intended to store it File_tbl fl = new File_tbl() { FileName = model.File.FileName, UploadOn = DateTime.Now, File = uploadedFile, CourseID = id }; db.File_tbl.Add(fl); db.SaveChanges(); db.Course_tbl.Find(id).PDFs = db.File_tbl.Where(m => m.CourseID == id).Count().ToString(); db.SaveChanges(); // add notification for every student registered to this course return(RedirectToAction("Create", "Notification", new { mthd = "Index", cntlr = "Course", course_id = id, subject = "New File is uploaded in ", role_not = "Student" })); }
public ActionResult UploadAssig(string id, FileDataVM model) { if (!ModelState.IsValid) { return(View(model)); } byte[] uploadedFile = new byte[model.File.InputStream.Length]; model.File.InputStream.Read(uploadedFile, 0, uploadedFile.Length); var assig = db.Event_tbl.Find(id); // now you could pass the byte array to your model and store wherever // you intended to store it File_tbl fl = new File_tbl() { FileName = model.File.FileName, UploadOn = DateTime.Now, File = uploadedFile, CourseID = assig.CourseID, AssignmentID = assig.ID }; db.File_tbl.Add(fl); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Edit([FromBody] FileDataVM filevm) { if (ModelState.IsValid) { FileDatum file = new FileDatum{FileId = filevm.FileId, FileName = filevm.FileName}; _file.UpdateFile(file, environment, filevm.OriginalFileName); } }
public ActionResult UploadImage(string id, FileDataVM model) { if (!ModelState.IsValid) { return(View(model)); } byte[] uploadedFile = new byte[model.File.InputStream.Length]; model.File.InputStream.Read(uploadedFile, 0, uploadedFile.Length); // now you could pass the byte array to your model and store wherever // you intended to store it var art = db.Lecturer_tbl.Find(id); art.Image = uploadedFile; db.Entry(art).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { id = id })); }
public ActionResult UploadImages(FileDataVM model) { if (!ModelState.IsValid) { return(View(model)); } byte[] uploadedFile = new byte[model.File.InputStream.Length]; model.File.InputStream.Read(uploadedFile, 0, uploadedFile.Length); // now you could pass the byte array to your model and store wherever // you intended to store it var art = db.Artists.Find(Session["ID"]); art.Image = uploadedFile; db.Entry(art).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult UploadFiles(string id) { var model = new FileDataVM(); return(View(model)); }
public ActionResult UploadImages() { var model = new FileDataVM(); return(View(model)); }
public ActionResult UploadAssig(string id) { var model = new FileDataVM(); return(PartialView(model)); }