public async Task <IActionResult> GetPhotosByPenjualanId(int Id) { List <Photo> photos = context.GetPhotoByPenjualanId(Id); foreach (var item in photos) { item.Thumb = await context.GetThumb(item); } return(Ok(photos)); }
// GET: api/Photos public async Task <IHttpActionResult> GetPhotosByPenjualanId(int Id) { PhotoContext context = new PhotoContext(); List <IPhoto> photos = context.GetPhotoByPenjualanId(Id); foreach (var item in photos) { var path = HttpContext.Current.Server.MapPath(string.Format("~/{0}/", item.Path)); context = new PhotoContext(path); item.Thumb = await context.GetThumb(item); } return(Ok(photos)); }