public async Task <News> Add(NewsAddDto newsAddDto, IFormFile file, IFormFile resim) { string ImageExtension = Path.GetExtension(file.FileName); string ImageName = Guid.NewGuid() + ImageExtension; string Imagepath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/img/" + ImageName); using (var ImageStream = new FileStream(Imagepath, FileMode.Create)) { await file.CopyToAsync(ImageStream); } string DetailImageExtension = Path.GetExtension(resim.FileName); string DetailImageName = Guid.NewGuid() + DetailImageExtension; string DetailImagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/img/" + DetailImageName); using (var DetailImageStream = new FileStream(DetailImagePath, FileMode.Create)) { await resim.CopyToAsync(DetailImageStream); } newsAddDto.ImagePath = ImageName; newsAddDto.BroadCastingStatus = "Bekliyor"; newsAddDto.DetailImagePath = DetailImageName; newsAddDto.Date = DateTime.Now; await _newsDal.AddAsync(_mapper.Map <News>(newsAddDto)); return(null); }