Ejemplo n.º 1
0
 public Alumini.Core.Album_Gallery Create(Alumini.Core.Album_Gallery obj)
 {
     using (var context = _dbContextFactory.CreateConnection())
     {
         context.Album_Gallery.Add(obj);
         context.SaveChanges();
         return(obj);
     }
 }
Ejemplo n.º 2
0
        public ActionResult Gallery(GalleryModel Gallery, IEnumerable<HttpPostedFileBase> Images, HttpPostedFileBase Videos)
        {
            if (ModelState.IsValid)
            {
                if (Gallery.selectionType == 2)
                {

                    var fileName = Path.GetFileName(Videos.FileName);
                    var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                    Videos.SaveAs(path);
                    var FilePath = "/UserProfilePictures/" + fileName;
                    Album_Gallery Album = new Album_Gallery()
                    {
                        CreateOn = DateTime.Now,
                        AlbumName = Gallery.Title,
                        GalleryDate = Gallery.GalleryDate,
                        Description = Gallery.Description,
                        AlbumType = "Videos",
                        Status = true
                    };
                    Album_Gallery gallery = AlbumGalleryService.Create(Album);
                    Album_Gallery_Images ImagesGallery = new Album_Gallery_Images()
                    {
                        Image = FilePath,
                        AlbumId = gallery.Galleryid,
                        CreatedOn = DateTime.Now,
                        AlbumType = "Videos",
                        Status = true
                    };

                    AlbumGalleryService.CreateImagesAndVideos(ImagesGallery);

                }
                else if (Gallery.selectionType == 1)
                {

                    Album_Gallery Album = new Album_Gallery()
                    {
                        CreateOn = DateTime.Now,
                        AlbumName = Gallery.Title,
                        GalleryDate = Gallery.GalleryDate,
                        Description = Gallery.Description,
                        AlbumType = "Images",
                        Status = true
                    };
                    Album_Gallery gallery = AlbumGalleryService.Create(Album);

                    foreach (var GalleryImages in Images)
                    {
                        var fileName = Path.GetFileName(GalleryImages.FileName);
                        var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                        GalleryImages.SaveAs(path);
                        var FilePath = "/UserProfilePictures/" + fileName;

                        Album_Gallery_Images ImagesGallery = new Album_Gallery_Images()
                        {
                            Image = FilePath,
                            AlbumId = gallery.Galleryid,
                            CreatedOn = DateTime.Now,
                            AlbumType = "Images",
                            Status = true
                        };

                        AlbumGalleryService.CreateImagesAndVideos(ImagesGallery);

                    }
                }
                TempData["Message"] = "Album Saved successfully..";
                return RedirectToAction("Gallery", "Gallery", new { area = "Admin" });
            }
            return View();
        }
Ejemplo n.º 3
0
 public Alumini.Core.Album_Gallery Create(Alumini.Core.Album_Gallery obj)
 {
     return(_courseCategoryRepo.Create(obj));
 }