public static AlbumClass EntityToModel(AlbumModel albumModel)
        {
            AlbumClass entity = new AlbumClass();

            entity.AlbumId   = albumModel.AlbumId;
            entity.AlbumName = albumModel.AlbumName;
            entity.Comment   = MapCommentsEntityModel(albumModel.AComment);
            return(entity);
        }
Beispiel #2
0
 public static AlbumModel MapAlbumModel(AlbumClass album)
 {
     return(new AlbumModel
     {
         AlbumId = album.AlbumId,
         AlbumName = album.AlbumName,
         AComment = album.Comment.Select(x => CommentsModelMapping.ModelToEntity(x)).ToList()
     });
 }
        public static AlbumModel ModelToEntity(AlbumClass entityModel)
        {
            var model = new AlbumModel();

            model.AlbumId   = entityModel.AlbumId;
            model.AlbumName = entityModel.AlbumName;

            model.AComment = MapCommentsModel(entityModel.Comment);
            return(model);
        }
Beispiel #4
0
        // GET: Photo
        public ActionResult AlbumList()
        {
            using (var context = new GalleryContext())
            {
                var NewAlbum = new AlbumClass();
                NewAlbum.AlbumID   = Guid.NewGuid();
                NewAlbum.AlbumName = "wowowowow";
                context.album.Add(NewAlbum);
                context.SaveChanges();
            }

            return(View(db.album.ToList()));
        }
Beispiel #5
0
 public void AddNewAlbum(AlbumClass newalbum)
 {
     using (var context = new MvcDataContext())
     {
         AlbumClass album = new AlbumClass();
         album.AlbumId   = newalbum.AlbumId;
         album.AlbumName = newalbum.AlbumName;
         album.Comment   = newalbum.Comment;
         //album.Photo = newalbum.Photo;
         context.album.Add(album);
         context.album.AddOrUpdate(album);
         context.SaveChanges();
     }
 }