예제 #1
0
        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");
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }