public IActionResult GetById([FromForm(Name = ("Id"))] int Id) { var result = _carImageService.Get(Id); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetById(int id) { var result = _CarImageService.Get(id); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetImageByCarId(int carId) { var result = _carImageService.Get(carId); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete([FromForm(Name = ("id"))] int id) { var result = _carImageService.Delete(_carImageService.Get(id).Data); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
//Aşağıda yoruma çekilen alanı açtığımda metoda parametre olarak Image ifadesini göndermemiz gerekmektedir. public IActionResult Update(/*[FromForm(Name = ("Image"))] */ IFormFile file, [FromForm] CarImage carImage) { var updatedCarImage = _carImageService.Get(carImage.Id).Data; var result = _carImageService.Update(file, updatedCarImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete([FromForm(Name = ("CarImageId"))] int carImageId) { var carImage = _carImageService.Get(carImageId).Data; var result = _carImageService.Delete(carImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Update([FromForm(Name = ("Image"))] IFormFile file, [FromForm(Name = ("Id"))] int Id) { var carImage = _carImageService.Get(Id).Data; var result = _carImageService.Update(file, carImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Update([FromForm(Name = ("Image"))] IFormFile file, [FromForm(Name = ("Id"))] int id) { var getImage = _carImageService.Get(id); var result = _carImageService.Update(getImage, file, id); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Get(int imageId) { var result = _carImageService.Get(imageId); if (result.Success == true) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete(int id) { var carImage = _carImageService.Get(id).Data; var result = _carImageService.Delete(carImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete([FromForm(Name = ("Id"))] int Id) //postmandeki Id buradaki [FromForm(Name="Id burayla aynı olmak zorunda")] { var carImage = _carImageService.Get(Id).Data; //burada veritabanına gidilir kontrol edilir varsa o tablonun bilgileri gelir var result = _carImageService.Delete(carImage); //sonra bu method çalışır bu method if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete(int id) { var data = _carImageService.Get(id); var result = _carImageService.Delete(data.Data); if (result.Success) { System.IO.File.Delete(Path.Combine(@"CarImages\" + data.Data.ImagePath)); return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete([FromForm(Name = "Id")] int Id) { var image = _imageService.Get(Id).Data; var result = _imageService.Delete(image); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Update([FromForm(Name = ("Image"))] IFormFile file, [FromForm] CarImage carImage) { var oldPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", _carImageService.Get(carImage.Id).Data.ImagePath); carImage.ImagePath = FileHelper.UpdateAsync(oldPath, file); var result = _carImageService.Update(carImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete([FromForm(Name = "Id")] int Id, [FromForm] CarImage carImage) { var path = _carImageService.Get(Id).Data.ImagePath; FileOperations.Delete(path); var result = _carImageService.Delete(_carImageService.Get(Id).Data); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult Delete([FromForm(Name = ("Id"))] int id) { //var result = _carImageService.Delete(carImage); //if (result.Success) //{ // return Ok(result); //} //return BadRequest(result); var carImage = _carImageService.Get(id).Data; var result = _carImageService.Delete(carImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult GetById(CarImage carImage) { var result = _carImageService.Get(carImage.Id); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IActionResult UpdateCarImage([FromForm(Name = ("Image"))] IFormFile file, [FromForm(Name = ("Id"))] int id) { var carImageResult = _carImageService.Get(id); var result = _carImageService.UpdateImage(file, carImageResult.Data); if (!result.Success) { return(BadRequest(result.Message)); } return(Ok(Messages.Successful)); }
public async Task <IActionResult> Get(string id) { var result = await _carImageService.Get(id); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public IDataResult <AllCarDetailsDto> GetCarAllInfo(int carId) { var carResult = _carDal.GetOneCarDetail(carId); var carImages = _carImageService.Get(carId); AllCarDetailsDto allCarDetailsDto = new AllCarDetailsDto { CarId = carResult.CarId, BrandName = carResult.BrandName, CarName = carResult.CarName, ColorName = carResult.ColorName, DailyPrice = carResult.DailyPrice, Description = carResult.Description, ModelYear = carResult.ModelYear, CarImages = carImages.Data }; return(new SuccessDataResult <AllCarDetailsDto>(allCarDetailsDto, Messages.Listed)); }