Exemplo n.º 1
0
        public ActionResult Add()
        {
            var fileStoreSvc = new FileStoreService();

            string filePath = fileStoreSvc.SaveNew(Request.Files[0].InputStream);

            string fileName = Path.GetFileName(filePath);

            var photo = new Photo()
                            {
                                CreatedDate = DateTime.Now,
                                ModifiedDate = DateTime.Now,
                                Description = "My new photo",
                                Filename = fileName,

                            };

            var albumsvc = new AlbumService();

            var album = albumsvc.GetById(2);

            album.Photos.Add(photo);

            albumsvc.Save();

            return View();
        }