public ActionResult ImageRetrieve(int imgID) { dbFilesEntities1 db = new dbFilesEntities1(); var img = db.StoreImages.SingleOrDefault(x => x.ImgId == imgID); return(File(img.ImgByte, "image/jpg")); }
public List <tbl_registration> GetData(string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord) { using (dbFilesEntities1 dc = new dbFilesEntities1()) { var v = (from a in dc.tbl_registration where a.Email.Contains(search) || a.Name.Contains(search) || a.City.Contains(search) select a ); totalRecord = v.Count(); v = v.OrderBy(sort + " " + sortdir); if (pageSize > 0) { v = v.Skip(skip).Take(pageSize); } return(v.ToList()); } }
public JsonResult ImageUpload(ImageViewModel model) { dbFilesEntities1 db = new dbFilesEntities1(); int ImgId = 0; var Lat = "Latitude"; var Lon = "Longitude"; var file = model.ImageFile; byte[] Imagebyte = null; if (file != null) { //var fileName = Path.GetFileName(file.FileName); //var extention = Path.GetExtension(file.FileName); //var filenamewithoutextension = Path.GetFileNameWithoutExtension(file.FileName); file.SaveAs(Server.MapPath("/UploadImage/" + file.FileName)); BinaryReader reader = new BinaryReader(file.InputStream); Imagebyte = reader.ReadBytes(file.ContentLength); StoreImage img = new StoreImage(); img.Lat = Lat; img.Lon = Lon; img.ImgTitle = file.FileName; img.ImgByte = Imagebyte; img.ImgPath = "/UploadedImage/" + file.FileName; img.IsDelete = 0; db.StoreImages.Add(img); db.SaveChanges(); ImgId = img.ImgId; } return(Json(ImgId, JsonRequestBehavior.AllowGet)); }
public ActionResult Executed() { dbFilesEntities1 db = new dbFilesEntities1(); return(View()); }