public ActionResult Create(Models.PhotoModel photo, HttpPostedFileBase file) { using (var context = new MvcDataContext()) { // TODO: Add insert logic here if (photo != null) { var phot = new PhotoClass(); phot.PhotoName = file.FileName; phot.PhotoId = Guid.NewGuid(); phot.Date = DateTime.Now; Path.GetFileName(file.FileName); file.SaveAs(Path.Combine(Server.MapPath("~/Pictures"), file.FileName)); context.photo.Add(phot); context.SaveChanges(); } return(View()); } }
public PhotoClass GetPhoto(Guid id) { using (var context = new MvcDataContext()) { return(context.photo.Include("Comment").FirstOrDefault(p => p.PhotoId == id)); } }
public ActionResult Comment() { using (var context = new MvcDataContext()) { } return(View()); }
public AlbumClass ShowAlbum(Guid id) { using (var context = new MvcDataContext()) { return(context.album.Include("Comment").FirstOrDefault(x => x.AlbumId == id)); } }
public AlbumEntityModel GetPhoto(Guid id) { using (var context = new MvcDataContext()) { return(context.AlbumEntityModels.Include("Comment").FirstOrDefault(x => x.AlbumId == id)); } }
public List <AlbumClass> GetAllAlbums() { using (var context = new MvcDataContext()) { var albums = context.album.Include("Comment").Include("Photo").ToList(); return(albums); } }
public List <PhotoClass> GetAllPhoto() { using (var context = new MvcDataContext()) { var photos = context.photo.Include("Comment").ToList(); return(photos); } }
public List <PhotoEntityModel> GetPhotos() { using (var context = new MvcDataContext()) { var photos = context.PhotoEntityModels.Include("Comment").ToList(); return(photos); } }
public List <AlbumEntityModel> GetAlbum() { using (var context = new MvcDataContext()) { var albums = context.AlbumEntityModels.Include("Comment").Include("Photo").ToList(); return(albums); } }
// GET: Gallery/Delete/5 public ActionResult Delete(Guid id) { using (var context = new MvcDataContext()) { var pht = context.photo.Single(x => x.PhotoId == id); return(View()); } }
public void DeletePhoto(PhotoClass photo) { using (var context = new MvcDataContext()) { var photoToDelete = context.photo.Include("Comment").FirstOrDefault(p => p.PhotoId == photo.PhotoId); context.photo.Remove(photoToDelete); context.photo.AddOrUpdate(photoToDelete); context.SaveChanges(); } }
public void AddNewAlbumComment(Guid albumid, CommentEntityModel newalbumComment) { using (var context = new MvcDataContext()) { var albumEnt = context.AlbumEntityModels.FirstOrDefault(x => x.AlbumId == albumid); albumEnt.Comment.Add(newalbumComment); context.AlbumEntityModels.AddOrUpdate(albumEnt); context.SaveChanges(); } }
public void AddNewPhotoComment(Guid photoid, CommentEntityModel newphotoComment) { using (var context = new MvcDataContext()) { var photoEnt = context.PhotoEntityModels.FirstOrDefault(x => x.PhotoId == photoid); photoEnt.Comment.Add(newphotoComment); context.PhotoEntityModels.AddOrUpdate(photoEnt); context.SaveChanges(); } }
public void AddNewPhotoComment(Guid photoid, CommentClass newphotoComment) { using (var context = new MvcDataContext()) { var photoentity = context.photo.FirstOrDefault(p => p.PhotoId == photoid); photoentity.PComment.Add(newphotoComment); context.photo.AddOrUpdate(photoentity); context.SaveChanges(); } }
public void AddNewAlbumComment(Guid albumid, CommentClass newalbumCommet) { using (var context = new MvcDataContext()) { var albumentity = context.album.FirstOrDefault(a => a.AlbumId == albumid); albumentity.Comment.Add(newalbumCommet); context.album.AddOrUpdate(albumentity); context.SaveChanges(); } }
public void DeleteAlbum(AlbumEntityModel album) { using (var context = new MvcDataContext()) { var deleteAlbum = context.AlbumEntityModels.Include("Comment").FirstOrDefault(x => x.AlbumId == album.AlbumId); context.AlbumEntityModels.Remove(deleteAlbum); context.AlbumEntityModels.AddOrUpdate(deleteAlbum); context.SaveChanges(); } }
public void DeletePhoto(PhotoEntityModel photo) { using (var context = new MvcDataContext()) { var deletePhoto = context.PhotoEntityModels.Include("Comment").FirstOrDefault(x => x.PhotoId == photo.PhotoId); context.PhotoEntityModels.Remove(deletePhoto); context.PhotoEntityModels.AddOrUpdate(deletePhoto); context.SaveChanges(); } }
public ActionResult Comment(string commentphoto) { using (var context = new MvcDataContext()) { var NewComment = new CommentClass(); NewComment.CommentOnPhoto = commentphoto; context.comment.Add(NewComment); context.SaveChanges(); } return(View("PhotList")); }
public PhotoEntityModel AddCommentPhoto(Guid id, string photoComment) { using (var context = new MvcDataContext()) { var photocomment = context.PhotoEntityModels.Include("Comment").FirstOrDefault(x => x.PhotoId == id); photocomment.Comment.Add(new CommentEntityModel { Id = Guid.NewGuid(), CommentPhoto = photoComment }); context.PhotoEntityModels.AddOrUpdate(photocomment); context.SaveChanges(); return(photocomment); } }
public void AddPhoto(PhotoEntityModel newphoto) { using (var context = new MvcDataContext()) { PhotoEntityModel photo = new PhotoEntityModel(); photo.PhotoId = newphoto.PhotoId; photo.PhotoName = newphoto.PhotoName; photo.Comment = newphoto.Comment; context.PhotoEntityModels.Add(photo); context.PhotoEntityModels.AddOrUpdate(photo); context.SaveChanges(); } }
public void AddPhotoToAlbum(IEnumerable <Guid> photos, Guid albumID) { using (var context = new MvcDataContext()) { var albumToAddIn = context.album.FirstOrDefault(x => x.AlbumId == albumID); foreach (var item in photos) { albumToAddIn.Photo.Add(context.photo.Include("Comment").FirstOrDefault(x => x.PhotoId == item)); } context.album.AddOrUpdate(albumToAddIn); context.SaveChanges(); } }
public AlbumClass AddCommentToAlbum(Guid id, string albumComment) { using (var context = new MvcDataContext()) { var albumtocomment = context.album.Include("Comment").FirstOrDefault(x => x.AlbumId == id); albumtocomment.Comment.Add(new CommentClass { Id = Guid.NewGuid(), CommentOnAlbum = albumComment }); context.album.AddOrUpdate(albumtocomment); context.SaveChanges(); return(albumtocomment); } }
public void AddPhoto(PhotoClass newphoto) { using (var context = new MvcDataContext()) { PhotoClass photo = new PhotoClass(); photo.PhotoId = newphoto.PhotoId; photo.PhotoName = newphoto.PhotoName; photo.PComment = newphoto.PComment; context.photo.Add(photo); context.photo.AddOrUpdate(photo); context.SaveChanges(); } }
public void AddAlbum(AlbumEntityModel newalbum) { using (var context = new MvcDataContext()) { AlbumEntityModel album = new AlbumEntityModel(); album.AlbumId = newalbum.AlbumId; album.AlbumName = newalbum.AlbumName; album.Comment = newalbum.Comment; context.AlbumEntityModels.Add(album); context.AlbumEntityModels.AddOrUpdate(album); context.SaveChanges(); } }
public AlbumEntityModel AddComment(Guid id, string albumComment) { using (var context = new MvcDataContext()) { var albumcomment = context.AlbumEntityModels.Include("Comment").FirstOrDefault(x => x.AlbumId == id); albumcomment.Comment.Add(new CommentEntityModel { Id = Guid.NewGuid(), CommentAlbum = albumComment }); context.AlbumEntityModels.AddOrUpdate(albumcomment); context.SaveChanges(); return(albumcomment); } }
public PhotoClass AddCommentToPhoto(Guid id, string photoComment) { using (var context = new MvcDataContext()) { var phototocomment = context.photo.Include("Comment").FirstOrDefault(x => x.PhotoId == id); phototocomment.PComment.Add(new CommentClass { Id = Guid.NewGuid(), CommentOnPhoto = photoComment }); context.photo.AddOrUpdate(phototocomment); context.SaveChanges(); return(phototocomment); } }
public ActionResult Delete(Guid id, FormCollection collection) { using (var context = new MvcDataContext()) { var i = context.photo.Single(x => x.PhotoId == id); context.photo.Remove(i); context.SaveChanges(); } // TODO: Add delete logic here return(RedirectToAction("PhotList")); }
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(); } }
public ActionResult CreateUser(Guid id, AccountClass user) { using (var context = new MvcDataContext()) { var NewUser = new AccountClass(); NewUser.FirstName = user.FirstName; NewUser.LastName = user.LastName; NewUser.Email = user.Email; NewUser.Password = user.Password; NewUser.Id = Guid.NewGuid(); context.account.Add(NewUser); context.SaveChanges(); } // TODO: Add insert logic here return(View()); }
public DatosController(MvcDataContext context) { _context = context; }