public ActionResult UploadPhotos(HttpPostedFileBase file, PhotoDTO photo) { //var extension = file.FileName.Substring(file.ToString().IndexOf(".")); var fileName = Path.Combine(("/Uploads"), (DateTime.Now.Ticks.ToString() + file.FileName)); file.SaveAs(fileName); _service.AddPhoto(photo, fileName); return RedirectToAction("Index", "Albums"); }
public void AddPhoto(PhotoDTO newPhoto, string url) { Photo photo = new Photo { ImageURL = url, Title = newPhoto.Title, Rating = newPhoto.Rating, Description = newPhoto.Description, }; _repo.Add <Photo>(photo); _repo.SaveChanges(); //return Mapper.Map<PhotoDTO>(photo); }
public void AddPhoto(PhotoDTO newPhoto, string url) { Photo photo = new Photo { ImageURL = url, Title = newPhoto.Title, Rating = newPhoto.Rating, Description = newPhoto.Description, }; _repo.Add<Photo>(photo); _repo.SaveChanges(); //return Mapper.Map<PhotoDTO>(photo); }