public ActionResult ConfirmDelete(int?DeleteId) { SpeciesDataTable RowToDelete = db.SpeciesDataTables.Find(DeleteId); db.SpeciesDataTables.Remove(RowToDelete); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult SpeciesDetail(int?DetailId) { if (DetailId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SpeciesDataTable DetailTable = db.SpeciesDataTables.Find(DetailId); if (DetailTable == null) { return(HttpNotFound()); } return(View(DetailTable)); }
public ActionResult SaveDataAdded([Bind(Include = "SId,Category,SName,LocalName,CommonName,Description,PicTakenBy,ContentBy,EditedBy")] SpeciesDataTable ARow, HttpPostedFileBase file, HttpPostedFileBase file2, HttpPostedFileBase file3, HttpPostedFileBase file4) { if (ModelState.IsValid) { if (file != null && file.ContentLength > 0) { using (var Bnryreader = new System.IO.BinaryReader(file.InputStream)) { ARow.MainPic = Bnryreader.ReadBytes(file.ContentLength); } } if (file2 != null && file2.ContentLength > 0) { using (var reader = new System.IO.BinaryReader(file2.InputStream)) { ARow.SecPic = reader.ReadBytes(file2.ContentLength); } } if (file3 != null && file3.ContentLength > 0) { using (var reader = new System.IO.BinaryReader(file3.InputStream)) { ARow.ThirdPic = reader.ReadBytes(file3.ContentLength); } } if (file4 != null && file4.ContentLength > 0) { using (var reader = new System.IO.BinaryReader(file4.InputStream)) { ARow.FourthPic = reader.ReadBytes(file4.ContentLength); } } db.SpeciesDataTables.Add(ARow); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ARow)); }
// delete get Request public ActionResult DeleteSpecies(int?DeleteId) { if (Session["user"] == null) { return(RedirectToAction("LogIn", "Account")); } if (DeleteId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SpeciesDataTable SMCForDelete = db.SpeciesDataTables.Find(DeleteId); if (SMCForDelete == null) { return(HttpNotFound()); } return(View(SMCForDelete)); }