public static Comments MapCommentsModel(CommentsEntityModel comments) { return(new Comments { Id = comments.Id, CommentOnPicture = comments.CommentPhoto, CommentOnAlbum = comments.CommentAlbum }); }
public static Comments ModelToEntity(CommentsEntityModel comments) { Comments model = new Comments(); model.Id = comments.Id; model.CommentOnPicture = comments.CommentPhoto; model.CommentOnAlbum = comments.CommentAlbum; return(model); }
public static CommentsEntityModel EntityToModel(Comments comments) { CommentsEntityModel entity = new CommentsEntityModel(); entity.Id = comments.Id; entity.CommentPhoto = comments.CommentOnPicture; entity.CommentAlbum = comments.CommentOnAlbum; return(entity); }
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(); } }
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(); } }