private List <AdvertismentsPhoto> GetAdvertismentPhotos(IEnumerable <HttpPostedFileBase> files) { var photos = new List <AdvertismentsPhoto>(); if (files != null) { foreach (HttpPostedFileBase file in files) { if (file == null || file.ContentLength == 0) { continue; } string pathPhotos = Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "Data/AdvertismentsPhotos"); string savedFileName = Path.Combine( pathPhotos, Path.GetFileName(file.FileName)); file.SaveAs(savedFileName); //--- make response var photoResponse = new Models.AdvertismentsPhoto(); photoResponse.filename = Path.GetFileName(file.FileName); photos.Add(photoResponse); } } return(photos); }
public Photo(Models.AdvertismentsPhoto entity) { this.Id = entity.Id; this.filename = entity.filename; }