예제 #1
0
 // GET: Photo
 public ActionResult Index()
 {
     PhotoAlbumRepository photoAlbumRepository = new PhotoAlbumRepository(new yslDataContext());
        var a  = photoAlbumRepository.getPhotoAlbumsWithPhotos().Take(10);
        ViewBag.photos = a;
     return View();
 }
예제 #2
0
 public ActionResult Get(int id)
 {
     PhotoAlbumRepository photoAlbumRepository = new PhotoAlbumRepository(new yslDataContext());
     PhotoAlbumData photoAlbumDataForJSON = photoAlbumRepository.getPhotoAlbumDataForJSON(id);
     ActionResult result;
     try
     {
         JsonResult jsonResult = new JsonResult();
         jsonResult.Data=photoAlbumDataForJSON;
         result = jsonResult;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         JsonResult jsonResult2 = new JsonResult();
         jsonResult2.Data ="";
         result = jsonResult2;
     }
     return result;
 }
예제 #3
0
 public ActionResult Processalbum(string meta, string uploads)
 {
     string[] array = uploads.Split(new char[]
     {
         ';'
     });
     string[] array2 = meta.Split(new char[]
     {
         '~'
     });
     IPhotoAlbumRepository photoAlbumRepository = new PhotoAlbumRepository(new yslDataContext());
     Request.Cookies.Get("ysl");
     int num = 5;
     PhotoAlbum photoAlbum;
     if (photoAlbumRepository.AccountPhotoAlbumExists(num, array2[0]))
     {
         photoAlbum = photoAlbumRepository.GetAccountPhotoAlbumByTitle(num, array2[0]);
     }
     else
     {
         PhotoAlbum album = new PhotoAlbum
         {
             AccountId = num,
             Title = array2[0],
             Description = array2[1]
         };
         int photoAlbumId = photoAlbumRepository.addPhotoAlbum(album);
         photoAlbum = photoAlbumRepository.getPhotoAlbum(photoAlbumId);
     }
     for (int i = 0; i < array.Length; i++)
     {
         if (!string.IsNullOrWhiteSpace(array[i]))
         {
             string[] array3 = array[i].Split(new char[]
             {
                 ','
             });
             string text = array3[0];
             text = text.Replace("/temp", "");
             string text2 = HostingEnvironment.MapPath(array3[0]);
             string destFileName = text2.Replace("\\temp", "");
             try
             {
                 System.IO.File.Move(text2, destFileName);
                 Photo photo = new Photo
                 {
                     AccountId = num,
                     Title = array3[1],
                     Description = "",
                     Location = text
                 };
                 photoAlbum.PhotoAlbumItems.Add(new PhotoAlbumItem
                 {
                     Photo = photo,
                     Created = DateTime.Now,
                     PhotoAlbumId = photoAlbum.PhotoAlbumId
                 });
                 photoAlbumRepository.updatePhotoAlbum(photoAlbum);
             }
             catch
             {
             }
         }
     }
     return View();
 }
예제 #4
0
 public ActionResult ViewAlbum(int aid)
 {
     var photoAlbumRepository = new PhotoAlbumRepository(new yslDataContext());
     var photoAlbum = photoAlbumRepository.getPhotoAlbum(aid);
     var photosForAlbum = photoAlbumRepository.GetPhotosForAlbum(aid);
     ViewBag.photos = photosForAlbum;
     ViewBag.album = photoAlbum;
      return View();
 }
예제 #5
0
                public ActionResult Photos()
		{
			IPhotoAlbumRepository photoAlbumRepository = new PhotoAlbumRepository(new yslDataContext());
			List<PhotoAlbumModel> photoAlbumsWithPhotos = photoAlbumRepository.getPhotoAlbumsWithPhotos();
			ViewBag.photos = photoAlbumsWithPhotos;
			return View("Photos", "~/Views/Shared/_LayoutAdmin.cshtml");
		}