Exemplo n.º 1
0
 public static Comments MapCommentsModel(CommentsEntityModel comments)
 {
     return(new Comments
     {
         Id = comments.Id,
         CommentOnPicture = comments.CommentPhoto,
         CommentOnAlbum = comments.CommentAlbum
     });
 }
Exemplo n.º 2
0
        public static Comments ModelToEntity(CommentsEntityModel comments)
        {
            Comments model = new Comments();

            model.Id = comments.Id;
            model.CommentOnPicture = comments.CommentPhoto;
            model.CommentOnAlbum   = comments.CommentAlbum;
            return(model);
        }
Exemplo n.º 3
0
        public static CommentsEntityModel EntityToModel(Comments comments)
        {
            CommentsEntityModel entity = new CommentsEntityModel();

            entity.Id           = comments.Id;
            entity.CommentPhoto = comments.CommentOnPicture;
            entity.CommentAlbum = comments.CommentOnAlbum;
            return(entity);
        }
Exemplo n.º 4
0
 public void AddNewAlbumComment(Guid albumid, CommentsEntityModel newalbumCommet)
 {
     using (var context = new MVCLabbRepositoryDbContext())
     {
         var albumentity = context.AlbumEntityModels.FirstOrDefault(a => a.AlbumId == albumid);
         albumentity.Comment.Add(newalbumCommet);
         context.AlbumEntityModels.AddOrUpdate(albumentity);
         context.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void AddNewPhotoComment(Guid photoid, CommentsEntityModel newphotoComment)
 {
     using (var context = new MVCLabbRepositoryDbContext())
     {
         var photoentity = context.PhotoEntityModels.FirstOrDefault(p => p.PhotoId == photoid);
         photoentity.Comment.Add(newphotoComment);
         context.PhotoEntityModels.AddOrUpdate(photoentity);
         context.SaveChanges();
     }
 }