public void DeleteCarSellerVehicleImage(CarSellerVehicleImage carsellervehicleimage)
 {
     if (carsellervehicleimage == null)
         throw new ArgumentException("CarSellerVehicleImage");
     _carSellerVehicleImageRepository.Delete(carsellervehicleimage);
 }
 public void UpdateCarSellerVehicleImage(CarSellerVehicleImage carSellerVehicleImage)
 {
     if (carSellerVehicleImage == null)
         throw new ArgumentNullException("CarSellerVehicleImage");
     _carSellerVehicleImageRepository.Update(carSellerVehicleImage);
 }
Esempio n. 3
0
        public ActionResult GetVehicleImage(string VehicleID)
        {
            if (Session["VehicleID"] != null)
            {
                int ID = Convert.ToInt32(Session["VehicleID"]);
                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/CarSellerImages/"), fName);
                        Idfile.SaveAs(path);
                        CarSellerVehicleImage model = new CarSellerVehicleImage();
                        model.VehicleID = ID;
                        model.OriginalFilename = "";
                        model.Filename = fName;
                        model.Size = 0;
                        model.Foldername = "~/Content/Assets/CarSellerImages/";
                        model.SectionFromImageUploaded = "Sell";
                        IList<CarSellerVehicleImage> vehicleImages = _carSellerVehicleImagesService.GetCarSellerVehicleImageByVehicleID(ID);

                        return Json(vehicleImages, JsonRequestBehavior.AllowGet);
                    }

                }
            }
            return Json(false, JsonRequestBehavior.AllowGet);
        }