public AlbumController()
 {
     AlbumAutomapper   = new AlbumAutomapper();
     PhotoAutomapper   = new PhotoAutomapper();
     CommentAutomapper = new CommentAutomapper();
     UserAutomapper    = new UserAutomapper();
 }
 public PhotoController()
 {
     _albumAutomapper   = new AlbumAutomapper();
     _photoAutomapper   = new PhotoAutomapper();
     _commentAutomapper = new CommentAutomapper();
     _userAutomapper    = new UserAutomapper();
 }
        public ActionResult AddPhotoToAlbum()
        {
            var model = new AlbumPhoto();

            model.Albums = AlbumAutomapper.FromBltoUiGetAll();
            model.Photos = PhotoAutomapper.FromBltoUiGetAll();
            return(PartialView("_AddPhotoToAlbum", model));
        }
        public ActionResult AddPhotoToAlbum(IEnumerable <Guid> photo, Guid albumId)
        {
            var album = AlbumAutomapper.FromBltoUiGetById(albumId);

            foreach (var item in photo)
            {
                var p = PhotoAutomapper.FromBltoUiGetById(item);
                //album.PhotosAView.Add(p);
                p.AlbumId = albumId;
                PhotoAutomapper.FromBltoUiInser(p);
            }
            return(Content("OK!"));
        }
        public async Task <ActionResult> AddPhotoToAlbum(IEnumerable <Guid> photo, Guid albumId)
        {
            if (photo == null)
            {
                return(Json(new { status = 0, Message = "Du måste välja en Photo!" }, JsonRequestBehavior.AllowGet));
            }
            foreach (var item in photo)
            {
                var p = await PhotoAutomapper.FromBltoUiGetById(item);

                p.AlbumId = albumId;
                await PhotoAutomapper.FromBltoUiEditoUpdateAsync(p);
            }
            return(Json(new { status = 1, Message = "Added Photo To Album Success" }, JsonRequestBehavior.AllowGet));
        }
        // GET: /Album/Details/5
        public ActionResult Details(Guid id)
        {
            var r = AlbumAutomapper.FromBltoUiGetById(id);

            if (r == null)
            {
                return(HttpNotFound());
            }
            var allpictur = PhotoAutomapper.FromBltoUiGetAllByAlbumId(id);
            var allcomm   = CommentAutomapper.FromBltoUiGetCommentByAlbumId(id);

            r.PhotosAView   = allpictur;
            r.CommentsAView = allcomm;
            return(PartialView("_DetailsAlbum", r));
            //return View(r);
        }
        public async Task <ActionResult> AddPhotoToAlbum(Guid id)
        {
            var model = new List <PhotoViewModel>();
            //model.Albums =  AlbumAutomapper.FromBltoUiGetAll();
            //model.Photos = await PhotoAutomapper.FromBltoUiGetAll();
            var t = await PhotoAutomapper.FromBltoUiGetAll();

            foreach (var item in t)
            {
                if (item.AlbumId == null)
                {
                    var p = new PhotoViewModel()
                    {
                        AlbumId   = id,
                        PhotoId   = item.PhotoId,
                        PhotoPath = item.PhotoPath,
                    };
                    model.Add(p);
                }
            }
            return(PartialView("_AddPhotoToAlbum", model));
        }
Beispiel #8
0
 public AlbumController()
 {
     AlbumAutomapper = new AlbumAutomapper();
     PhotoAutomapper = new PhotoAutomapper();
 }