public ActionResult GetVehicleImageMore(string AuctionHouseVehicleID) { if (Session["AuctionHouseVehicleID"] != null) { long ID = Convert.ToInt64(Session["AuctionHouseVehicleID"]); if (Request.Files.Count > 0) { var Idfile = Request.Files[0]; if (Idfile != null && Idfile.ContentLength > 0) { var filename = Path.GetFileName(Idfile.FileName); string extension = Path.GetExtension(Idfile.FileName); string fName = DateTime.Now.ToString("yyyyMMdd_hhss") + extension; var path = Path.Combine(Server.MapPath("~/Content/Assets/AuctionHouseSaleImagesMore/"), fName); Idfile.SaveAs(path); AuctionHouseCarSellingVehicleImagesMore model = new AuctionHouseCarSellingVehicleImagesMore(); model.AuctionHouseCarSellingID = ID; model.Filename = ""; model.Filename = fName; model.Size = 0; model.Foldername = "~/Content/Assets/AuctionHouseSaleImagesMore/"; IList<AuctionHouseCarSellingVehicleImagesMore> vehicleImages = _auctionHouseCarSellingVehicleImagesMoreService.GetAuctionHouseCarSellingVehicleImagesMore().Where(t => t.AuctionHouseCarSellingID == ID).ToList(); return Json(vehicleImages, JsonRequestBehavior.AllowGet); } } } return Json(false, JsonRequestBehavior.AllowGet); }
public ActionResult UploadImage(AuctionHouseAddEditVehicleModel model) { List<AuctionHouseCarSellingVehicleImagesMore> imgList = new List<AuctionHouseCarSellingVehicleImagesMore>(); AuctionHouseCarSellingVehicleImagesMore img = new AuctionHouseCarSellingVehicleImagesMore(); long AuctionHouseVehicleID = Convert.ToInt64(Session["AuctionHouseVehicleID"]); if (AuctionHouseVehicleID != 0) { long ID = AuctionHouseVehicleID; if (Request.Files.Count > 0) { for (int i = 0; i < Request.Files.Count; i++) { var Idfile = Request.Files[i]; if (Idfile != null && Idfile.ContentLength > 0) { var filename = Path.GetFileName(Idfile.FileName); string extension = Path.GetExtension(Idfile.FileName); string fName = DateTime.Now.ToString("yyyyMMdd_hhssfff") + extension; var path = Path.Combine(Server.MapPath("~/Content/Assets/AuctionHouseSaleImagesMore/"), fName); Idfile.SaveAs(path); img.AuctionHouseCarSellingID = ID; img.Filename = fName; img.Size = 0; img.Foldername = "~/Content/Assets/AuctionHouseSaleImagesMore/"; _auctionHouseCarSellingVehicleImagesMoreService.InsertAuctionHouseCarSellingVehicleImage(img); } } } } return Json(img, JsonRequestBehavior.AllowGet); }
public void UpdateAuctionHouseCarSellingVehicleImage(AuctionHouseCarSellingVehicleImagesMore auctionHouseCarSellingVehicleImageMore) { if (auctionHouseCarSellingVehicleImageMore == null) throw new ArgumentNullException("auctionHouseCarSaleVehicleImageMore"); _auctionHouseCarSellingVehicleImagesMoreRepository.Update(auctionHouseCarSellingVehicleImageMore); }