public ActionResult FilterPhoto(PhotoFilter filter = PhotoFilter.None)
        {
            var model = new PhotoListModel();

            try
            {
                switch (filter)
                {
                case PhotoFilter.Random:
                    model.Photos = _photoService.GetRandomPhotos().InitPhotoListModel();
                    break;

                case PhotoFilter.NoAlbum:
                    model.Photos = _photoService.GetOrphans().InitPhotoListModel();
                    break;

                case PhotoFilter.Background:
                    model.Photos = _photoService.GetBackgroundPhotos().InitPhotoListModel();
                    break;

                default:
                    model.Photos = _photoService.GetRandomPhotos().Union(_photoService.GetOrphans()).Union(_photoService.GetBackgroundPhotos()).InitPhotoListModel();
                    break;
                }
            }
            catch (Exception exception)
            {
                Log.RegisterError(exception);
            }
            return(PartialView("~/Views/Management/_PhotoList.cshtml", model));
        }
Пример #2
0
        public ActionResult PhotoIndex()
        {
            var model = new PhotoListModel()
            {
                Photos = _photoService.InitPhotoListModel()
            };

            return(View(model));
        }
Пример #3
0
        //
        // GET: /Photo/

        public ActionResult BrowsePhotos(int start)
        {
            HttpContext.Response.AppendHeader("Access-Control-Allow-Origin", Config.AlowDomain);
            HttpContext.Response.AppendHeader("Access-Control-Allow-Credentials", "true");
            var  model = new PhotoListModel();
            bool hasMore;
            long?userId = null;

            if (Session[SessionKey.User] != null)
            {
                var user = (UserEntity)Session[SessionKey.User];
                userId = user.Id;
            }
            model.Photos  = PhotoService.BrowsePhotos(start, Config.PageSize, userId, false, out hasMore);
            model.HasMore = hasMore;
            var result = new ResponseModel(ResponseStatus.Success, string.Empty, model);

            var json = Json(result);

            json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(json);
        }
Пример #4
0
 public SendAddPhoto(PhotoListModel photoModel, int albumId)
 {
     PhotoModel = photoModel;
     AlbumId    = albumId;
 }