public ActionResult showDetails(int galleryimagesid)
        {
            //check if the user is logged in (true if logged in)
            bool isLoggedIn = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated;
            //is admin is false by default
            bool isAdmin = false;

            //if the user is logged in, isAdmin = whether or not the user is an admin
            if (isLoggedIn)
            {
                //below custom column check from https://stackoverflow.com/questions/31864400/how-get-custom-field-in-aspnetusers-table
                isAdmin = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(User.Identity.GetUserId()).is_admin;
            }

            //Pass whether or not this user is a logged in admin through the tempdata
            //only admins should be able to see edit and delete buttons
            TempData["isAdmin"] = isAdmin;

            Debug.WriteLine("Receiving galleryimagesid in the ajax call as " + galleryimagesid);
            //grabbing the galleryImage object
            GalleryImages galleryImages = db.GalleryImages.Find(galleryimagesid);

            //returns a partial view with the given galleryImage and prints it back to whichever div the jquery call indicated in the view
            //(in this case, it will be inside a modal window)
            return(PartialView("_showImage", galleryImages));
        }
        // GET: GalleryImages/Delete/5
        public ActionResult Delete(int?id)
        {
            //check if the user is logged in (true if logged in)
            bool isLoggedIn = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated;
            //is admin is false by default
            bool isAdmin = false;

            //if the user is logged in, isAdmin = whether or not the user is an admin
            if (isLoggedIn)
            {
                //below custom column check from https://stackoverflow.com/questions/31864400/how-get-custom-field-in-aspnetusers-table
                isAdmin = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(User.Identity.GetUserId()).is_admin;
            }

            //if the user isn't a logged or not an admin, redirect to the Index list view
            if (!isLoggedIn || !isAdmin)
            {
                return(RedirectToAction("Index"));
            }

            //have the delete page redirect if user is not a logged in admin
            if (id == null)
            {
                //change to redirect to list page
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GalleryImages galleryImages = db.GalleryImages.Find(id);

            if (galleryImages == null)
            {
                //this is fine to keep
                return(HttpNotFound());
            }
            return(View(galleryImages));
        }
        /// <summary>
        ///     Essentially resets this object for next use. Could dispose and make a new one
        ///     but where is the fun in that?
        /// </summary>
        public void VoidEvent()
        {
            if (_data.RSettings.ProgramSettings.Debug)
            {
                _ = _log.LogMessage("Voiding test event", false, color: LOG_COLOR);
            }

            IsValid       = false;
            CanUseGallery = false;
            EventEditTime = null;
            StartDateTime = null;
            EndDateTime   = null;
            Title         = null;
            Creators.Clear();
            Creators.TrimExcess();
            GalleryImages.Clear();
            GalleryImages.TrimExcess();
            ImageGallery     = null;
            WorkshopLink     = null;
            IsCasual         = true;
            Moderator        = null;
            Description      = null;
            ServerLocation   = null;
            CompPassword     = null;
            CompCasualServer = null;
        }
Esempio n. 4
0
        /// <summary>
        /// Initialize a new instance of the KryptonGallery class.
        /// </summary>
        public KryptonGallery()
        {
            // Defaults
            _mouseOver          = false;
            _alwaysActive       = true;
            _selectedIndex      = -1;
            _trackingIndex      = -1;
            _eventTrackingIndex = -1;
            _preferredItemSize  = new Size(5, 1);
            _dropMaxItemWidth   = 128;
            _dropMinItemWidth   = 3;

            // Timer used to generate tracking change event
            _trackingEventTimer = new Timer
            {
                Interval = 120
            };
            _trackingEventTimer.Tick += OnTrackingTick;

            // Create content storage
            Images           = new GalleryImages(NeedPaintDelegate);
            DropButtonRanges = new KryptonGalleryRangeCollection();

            // Create the palette storage
            StateCommon   = new PaletteGalleryRedirect(Redirector, NeedPaintDelegate);
            StateNormal   = new PaletteGalleryState(StateCommon, NeedPaintDelegate);
            StateDisabled = new PaletteGalleryState(StateCommon, NeedPaintDelegate);
            StateActive   = new PaletteGalleryState(StateCommon, NeedPaintDelegate);

            // Create and organize the buttons
            _buttonUp      = new ViewDrawRibbonGalleryButton(Redirector, PaletteRelativeAlign.Near, PaletteRibbonGalleryButton.Up, Images, NeedPaintDelegate);
            _buttonDown    = new ViewDrawRibbonGalleryButton(Redirector, PaletteRelativeAlign.Center, PaletteRibbonGalleryButton.Down, Images, NeedPaintDelegate);
            _buttonContext = new ViewDrawRibbonGalleryButton(Redirector, PaletteRelativeAlign.Far, PaletteRibbonGalleryButton.DropDown, Images, NeedPaintDelegate);
            _buttonsLayout = new ViewLayoutRibbonGalleryButtons
            {
                _buttonUp,
                _buttonDown,
                _buttonContext
            };

            // The draw layout that contains the actual selection images
            _backBorder = new PaletteGalleryBackBorder(StateNormal);
            _drawDocker = new ViewDrawDocker(_backBorder, _backBorder);
            _drawItems  = new ViewLayoutRibbonGalleryItems(Redirector, this, NeedPaintDelegate, _buttonUp, _buttonDown, _buttonContext);
            _drawDocker.Add(_drawItems, ViewDockStyle.Fill);

            // Top level layout view
            _layoutDocker = new ViewLayoutDocker
            {
                { _drawDocker, ViewDockStyle.Fill },
                { _buttonsLayout, ViewDockStyle.Right }
            };

            // Create the view manager instance
            ViewManager = new ViewManager(this, _layoutDocker);

            // Set the default padding value
            base.Padding = new Padding(3);
        }
Esempio n. 5
0
 public List <FactFileEntryImage> GetFactFileEntryImages()
 {
     return(GalleryImages?.Select(s => new FactFileEntryImage
     {
         FactFileEntryId = Id,
         MediaFileId = s
     }).ToList());
 }
Esempio n. 6
0
 public void DeleteGalleryImage(GalleryImages gallery)
 {
     if (gallery == null)
     {
         throw new ArgumentNullException("gallery");
     }
     _galleryImagesRepository.Delete(gallery);
     UpdateGalleryImage(gallery);
 }
        protected void UpdateImagePictureSeoNames(GalleryImages gallery)
        {
            var picture = _pictureService.GetPictureById(gallery.PictureId);

            if (picture != null)
            {
                _pictureService.SetSeoFilename(picture.Id, _pictureService.GetPictureSeName(gallery.Name));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            //since the page will automatically redirect if not a logged in admin, only an admin will be able to submit this form.
            GalleryImages galleryImages = db.GalleryImages.Find(id);

            //remember to delete the image file from the server as well here.
            db.GalleryImages.Remove(galleryImages);
            db.SaveChanges();
            return(RedirectToAction("Index", new { delete = true }));
        }
Esempio n. 9
0
        private void BuildMassTagPlots(MassTagsLoadedEventArgs e)
        {
            var view = new FeaturePlotView {
                MassTagsData = e
            };

            GalleryImages.Insert(0, view);
            if (GalleryImages.Count > 10)
            {
                GalleryImages.RemoveAt(9);
            }
        }
Esempio n. 10
0
        /// <summary>
        ///     Builds the alignment plot views.
        /// </summary>
        private void BuildClusterPlots(List <UMCClusterLight> clusters)
        {
            var view = new ClustersPlotView {
                Clusters = clusters
            };

            GalleryImages.Insert(0, view);
            if (GalleryImages.Count > 10)
            {
                GalleryImages.RemoveAt(0);
            }
        }
Esempio n. 11
0
        /// <summary>
        ///     Builds the alignment plot views.
        /// </summary>
        /// <param name="e"></param>
        private void BuildAlignmentPlotView(FeaturesAlignedEventArgs e)
        {
            var view = new AlignmentPlotView {
                AlignmentData = e
            };

            GalleryImages.Insert(0, view);

            if (GalleryImages.Count > 10)
            {
                GalleryImages.RemoveAt(0);
            }
        }
Esempio n. 12
0
        public void InsertForm()
        {
            string new_filename = string.Empty;

            if (fuImage.PostedFile.ContentLength != 0)
            {
                string original_filename = Path.GetFileName(fuImage.PostedFile.FileName);

                new_filename =
                    Guid.NewGuid().ToString() +
                    Path.GetExtension(original_filename);

                string new_filepath = Server.MapPath("~/Uploads/Gallery/" + new_filename);
                fuImage.PostedFile.SaveAs(new_filepath);
                ViewState["GImage"] = new_filename;
            }

            using (VaranegarEntities db = new VaranegarEntities())
            {
                GalleryImages pg = new GalleryImages();

                pg.Id    = Guid.NewGuid();
                pg.Title = txtTitle.Text;
                if (!string.IsNullOrEmpty(txtVideoLink.Text))
                {
                    pg.VideoLink = txtVideoLink.Text;
                }
                else
                {
                    pg.VideoLink = null;
                }
                pg.ImageUrl = new_filename;
                pg.Priority = Convert.ToInt32(txtPrio.Text);
                pg.Summery  = txtSummery.Text;

                if (ddlGroup.SelectedValue != "-1")
                {
                    pg.fk_GalleryId = new Guid(ddlGroup.SelectedValue);
                }
                else
                {
                    pg.fk_GalleryId = null;
                }

                pg.SubmitDate = DateTime.Now;
                pg.IsDelete   = false;
                db.GalleryImages.Add(pg);
                db.SaveChanges();
            }
        }
Esempio n. 13
0
 public ImageGalleryViewData(FirmaSession currentFirmaSession, string galleryName, IEnumerable <FileResourcePhoto> galleryImages, bool canAddPhotos, string addNewPhotoUrl, string selectKeyImageUrl, bool isGalleryMode, Func <FileResourcePhoto, object> sortFunction, string imageEntityName)
 {
     CurrentPerson         = currentFirmaSession.Person;
     GalleryImages         = galleryImages.ToList();
     UserCanAddPhotos      = canAddPhotos;
     SelectKeyImageUrl     = selectKeyImageUrl;
     AddNewPhotoUrl        = addNewPhotoUrl;
     GalleryName           = galleryName;
     UserCanSelectKeyPhoto = !string.IsNullOrWhiteSpace(selectKeyImageUrl);
     CurrentKeyPhotoID     = (UserCanSelectKeyPhoto && GalleryImages.Any(x => x.IsKeyPhoto)) ? GalleryImages.Single(x => x.IsKeyPhoto).PrimaryKey : ModelObjectHelpers.NotYetAssignedID;
     IsGalleryMode         = isGalleryMode;
     SortFunction          = sortFunction;
     ImageEntityName       = imageEntityName;
 }
Esempio n. 14
0
        public void UpdateGalleryImage(GalleryImages gallery)
        {
            if (gallery == null)
            {
                throw new ArgumentNullException("gallery");
            }
            _galleryImagesRepository.Update(gallery);

            //cache
            _cacheManager.RemoveByPattern(GALLERY_IMAGES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityUpdated(gallery);
        }
        protected void UpdateImageLocales(GalleryImages gallery, ConfigurationGalleryImagesModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(gallery,
                                                           x => x.Name,
                                                           localized.Name,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(gallery,
                                                           x => x.Description,
                                                           localized.Description,
                                                           localized.LanguageId);
            }
        }
Esempio n. 16
0
 /// <summary>
 ///     Builds the alignment plot views.
 /// </summary>
 /// <param name="e"></param>
 private void BuildBaselineView(BaselineFeaturesLoadedEventArgs e)
 {
     // We dont care about the dataset
     if (e.DatasetInformation != null)
     {
         var view = new FeaturePlotView {
             BaselineData = e
         };
         GalleryImages.Insert(0, view);
         if (GalleryImages.Count > 10)
         {
             GalleryImages.RemoveAt(0);
         }
     }
 }
        // GET: GalleryImages/Details/5
        public ActionResult Details(int?id)
        {
            //**THIS PAGE IS NO LONGER USED - REMOVE AT SOME POINT
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GalleryImages galleryImages = db.GalleryImages.Find(id);

            if (galleryImages == null)
            {
                return(HttpNotFound());
            }
            //since it is not used, redirect to the list
            return(RedirectToAction("Index"));
        }
        public ActionResult CreateImage(ConfigurationGalleryImagesModel model)
        {
            if (ModelState.IsValid)
            {
                //var gallery = model.ToEntity();
                var gallery = new GalleryImages
                {
                    Name         = model.Name,
                    Description  = model.Description,
                    DisplayOrder = model.DisplayOrder,
                    PictureId    = model.PictureId,
                    UpdatedOnUtc = DateTime.UtcNow,
                    CreatedOnUtc = DateTime.UtcNow,
                };

                if (model.SelectedOptions != null)
                {
                    foreach (var option in model.SelectedOptions)
                    {
                        var gal = _galleryService.GetGalleryById(int.Parse(option));

                        if (gallery.Galleries.Count(g => g.Id == gallery.Id) == 0)
                        {
                            gallery.Galleries.Add(gal);
                        }
                    }
                }
                _galleryService.InsertGalleryImage(gallery);

                //locales
                UpdateImageLocales(gallery, model);
                //update picture seo file name
                UpdateImagePictureSeoNames(gallery);

                SuccessNotification(_localizationService.GetResource("Plugin.Widgets.Gallery.GalleryConfigureController.ImageAdded"));
            }
            var galleries = _galleryService.GetAllGalleries();

            foreach (var gallery in galleries)
            {
                model.ListGalleries.Add(new SelectListItem {
                    Text = gallery.Name, Value = gallery.Id.ToString(CultureInfo.InvariantCulture)
                });
            }

            return(View("~/Plugins/Widgets.Gallery/Views/GalleryConfigure/CreateImage.cshtml", model));
        }
Esempio n. 19
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawRibbonGalleryButton class.
 /// </summary>
 /// <param name="palette">Reference to inherited palette.</param>
 /// <param name="alignment">Button alignment within gallery.</param>
 /// <param name="button">Button content to display.</param>
 /// <param name="images">Button images.</param>
 /// <param name="needPaint">Paint event delegate.</param>
 public ViewDrawRibbonGalleryButton(IPalette palette,
                                    PaletteRelativeAlign alignment,
                                    PaletteRibbonGalleryButton button,
                                    GalleryImages images,
                                    NeedPaintHandler needPaint)
 {
     _palette           = palette;
     _alignment         = alignment;
     _button            = button;
     _images            = images;
     _needPaint         = needPaint;
     _paletteBack       = new PaletteBackToPalette(palette, PaletteBackStyle.ButtonGallery);
     _paletteBorder     = new PaletteBorderToPalette(palette, PaletteBorderStyle.ButtonGallery);
     _paletteContent    = new PaletteContentToPalette(palette, PaletteContentStyle.ButtonGallery);
     _controller        = new GalleryButtonController(this, needPaint, (alignment != PaletteRelativeAlign.Far));
     _controller.Click += OnButtonClick;
     MouseController    = _controller;
 }
Esempio n. 20
0
        public void Start(AnalysisConfig config)
        {
            // Set the messages
            Messages.Clear();
            GalleryImages.Clear();

            IsAnalysisRunning             = true;
            Reporter.Config               = config;
            m_configuration               = config;
            Controller                    = new AnalysisController();
            Controller.AnalysisComplete  += Controller_AnalysisComplete;
            Controller.AnalysisError     += Controller_AnalysisError;
            Controller.AnalysisCancelled += Controller_AnalysisCancelled;
            Controller.AnalysisStarted   += ControllerOnAnalysisStarted;

            // Start the analysis.
            Controller.StartMultiAlignGui(config, this);
        }
 public static ConfigurationGalleryImagesModel ToModel(this GalleryImages entity)
 {
     return(Mapper.Map <GalleryImages, ConfigurationGalleryImagesModel>(entity));
 }
 public static GalleryImages ToEntity(this ConfigurationGalleryImagesModel model, GalleryImages destination)
 {
     return(Mapper.Map(model, destination));
 }
        public ActionResult Edit(int galleryImagesId, string galleryImagesTitle, HttpPostedFileBase galleryImageFile, string galleryImageAlt, string galleryImagesDescription)
        {
            GalleryImages galleryImage = new GalleryImages();

            //since the page will automatically redirect if not a logged in admin, only an admin will be able to submit this form.
            if (ModelState.IsValid)
            {
                galleryImage.galleryimagetitle       = galleryImagesTitle;
                galleryImage.galleryimagealt         = galleryImageAlt;
                galleryImage.galleryimagedate        = DateTime.Now;
                galleryImage.galleryimagedescription = galleryImagesDescription;

                //Probably should put below code in a method at some point
                /**BELOW CODE BORROWED FROM CLASS EXAMPLE - https://github.com/christinebittle/PetGroomingMVC/blob/master/PetGrooming/Controllers/PetController.cs**/
                string galleryImageExt = "";
                //checking to see if an image was uploaded
                if (galleryImageFile != null)
                {
                    Debug.WriteLine("File was uploaded...");
                    //checking to see if the file size is greater than 0 (bytes)
                    if (galleryImageFile.ContentLength > 0)
                    {
                        Debug.WriteLine("Successfully Identified Image");
                        Debug.WriteLine("Image uploaded was " + galleryImageFile.FileName);

                        //file extensioncheck taken from https://www.c-sharpcorner.com/article/file-upload-extension-validation-in-asp-net-mvc-and-javascript/
                        var valtypes  = new[] { "jpeg", "jpg", "png", "gif" };
                        var extension = Path.GetExtension(galleryImageFile.FileName).Substring(1);

                        if (valtypes.Contains(extension))
                        {
                            try
                            {
                                //file name is the id of the image
                                string fileName = galleryImagesId + "." + extension;

                                //get a direct file path to ~/Content/Artists/{id}.{extension}
                                string path = Path.Combine(Server.MapPath("~/Content/GalleryImages/"), Path.GetFileName(fileName));

                                //delete the old image (to save server space if needed)
                                GalleryImages thisImage = db.GalleryImages.Find(galleryImagesId);
                                FileInfo      fileInfo  = new FileInfo(Server.MapPath("~/Content/GalleryImages/" + thisImage.galleryimageref));
                                fileInfo.Delete();
                                Debug.WriteLine("This file was deleted: " + thisImage.galleryimageref);


                                //save the file

                                galleryImageFile.SaveAs(path); //will overwrite any existing file with this name
                                                               //if these are all successful then we can set these fields
                                galleryImageExt = fileName;
                                Debug.WriteLine("Saving gallery image at " + path);
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine("Gallery Image was not saved successfully.");
                                Debug.WriteLine("Exception:" + ex);
                            }
                        }
                    }
                }//else, no file was uploaded. Don't save anything new.
                else
                {
                    //check the image's current ref and set the new extension to be the old one (ie. don't set it to empty upon update)
                    GalleryImages thisImage = db.GalleryImages.Find(galleryImagesId);
                    if (thisImage == null)
                    {
                        Debug.WriteLine("Somehow GalleryImage wasn't found when checking what its old extension was?");
                    }
                    //if there exists a current image for this entry
                    else if (thisImage.galleryimageref != null)
                    {
                        galleryImageExt = thisImage.galleryimageref;
                    }
                    //in case galleryImageExt was never set somehow
                    if (galleryImageExt == "")
                    {
                        galleryImageExt = thisImage.galleryimageref;
                    }
                }

                galleryImage.galleryimageref = galleryImageExt;
                //Below code seems to be giving me errors since I'm changing form input data before updating so I will use SQL instead
                //db.Entry(galleryImage).State = EntityState.Modified;
                //db.SaveChanges();

                string query = "update GalleryImages set galleryimageref=@imageref, galleryimagetitle=@imagetitle, galleryimagealt=@imagealt, " +
                               "galleryimagedate=@imagedate, galleryimagedescription=@imagedescription where galleryimageid=@id";
                SqlParameter[] sqlparams = new SqlParameter[6];
                sqlparams[0] = new SqlParameter("@imageref", galleryImageExt);
                sqlparams[1] = new SqlParameter("@imagetitle", galleryImage.galleryimagetitle);
                sqlparams[2] = new SqlParameter("@imagealt", galleryImage.galleryimagealt);
                sqlparams[3] = new SqlParameter("@imagedate", galleryImage.galleryimagedate);
                sqlparams[4] = new SqlParameter("@imagedescription", galleryImage.galleryimagedescription);
                sqlparams[5] = new SqlParameter("@id", galleryImagesId);

                db.Database.ExecuteSqlCommand(query, sqlparams);

                return(RedirectToAction("Index", new { update = true }));
            }
            return(View(galleryImage));
        }
Esempio n. 24
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());
        }
        public ActionResult Create(string galleryImagesTitle, HttpPostedFileBase galleryImageFile, string galleryImageAlt, string galleryImagesDescription)
        {
            GalleryImages galleryImage = new GalleryImages();

            //Bind takes form field values and puts them into a GalleryImages object
            //try to implement file upload on create
            if (ModelState.IsValid)
            {
                galleryImage.galleryimagetitle       = galleryImagesTitle;
                galleryImage.galleryimagealt         = galleryImageAlt;
                galleryImage.galleryimagedate        = DateTime.Now;
                galleryImage.galleryimagedescription = galleryImagesDescription;
                //I will upload the image at the next stage
                galleryImage.galleryimageref = "";

                //add the galleryImage object to the database and save changes
                db.GalleryImages.Add(galleryImage);
                db.SaveChanges();

                //now that its added, I can get the ID and update at the ID with the image file named after the ID
                int id = galleryImage.galleryimageid;
                Debug.WriteLine("ID of newly added image is " + id);

                //image uploading here
                /**BELOW CODE BORROWED FROM CLASS EXAMPLE - https://github.com/christinebittle/PetGroomingMVC/blob/master/PetGrooming/Controllers/PetController.cs**/
                string galleryImageExt = "";
                //checking to see if an image was uploaded
                if (galleryImageFile != null)
                {
                    Debug.WriteLine("File was uploaded...");
                    //checking to see if the file size is greater than 0 (bytes)
                    if (galleryImageFile.ContentLength > 0)
                    {
                        Debug.WriteLine("Successfully Identified Image");
                        Debug.WriteLine("Image uploaded was " + galleryImageFile.FileName);

                        //file extensioncheck taken from https://www.c-sharpcorner.com/article/file-upload-extension-validation-in-asp-net-mvc-and-javascript/
                        var valtypes  = new[] { "jpeg", "jpg", "png", "gif" };
                        var extension = Path.GetExtension(galleryImageFile.FileName).Substring(1);

                        if (valtypes.Contains(extension))
                        {
                            try
                            {
                                //file name is the id of the image
                                string fileName = id + "." + extension;

                                //get a direct file path to ~/Content/Artists/{id}.{extension}
                                string path = Path.Combine(Server.MapPath("~/Content/GalleryImages/"), Path.GetFileName(fileName));

                                //save the file

                                galleryImageFile.SaveAs(path); //will overwrite any existing file with this name
                                                               //if these are all successful then we can set these fields
                                galleryImageExt = fileName;
                                Debug.WriteLine("Saving gallery image at " + path);
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine("Gallery Image was not saved successfully.");
                                Debug.WriteLine("Exception:" + ex);
                            }
                        }
                    }
                }//else, no file was uploaded. Don't save anything new.


                string         query     = "update GalleryImages set galleryimageref=@imageref where galleryimageid=@id";
                SqlParameter[] sqlparams = new SqlParameter[2];
                sqlparams[0] = new SqlParameter("@imageref", galleryImageExt);
                sqlparams[1] = new SqlParameter("@id", id);

                Debug.WriteLine("Setting galleryimageref = " + galleryImageExt + " for the image with id=" + id);

                db.Database.ExecuteSqlCommand(query, sqlparams);
                return(RedirectToAction("Index", new { add = true }));
            }

            return(View(galleryImage));
        }