public ActionResult AddNewArtist(HttpPostedFileBase file, string name, int genre_id) { if (Session["Roles"] != null && Session["Roles"].Equals("Admin")) { hypster_tv_DAL.visualSearchManager visualSearchManager = new hypster_tv_DAL.visualSearchManager(); if (visualSearchManager.getVisualSearchArtistByName(name).VisualSearch_ID == 0) //if not exist yet - then add new artist { string savePath = System.Configuration.ConfigurationManager.AppSettings["visualSearchStorage_Path"] + "\\" + name + ".jpg"; file.SaveAs(savePath); hypster_tv_DAL.Image_Resize_Manager image_resizer = new hypster_tv_DAL.Image_Resize_Manager(); image_resizer.Resize_Image(savePath, -1, 120, System.Drawing.Imaging.ImageFormat.Jpeg); int ImWidth = 0; System.Drawing.Image img = System.Drawing.Image.FromFile(savePath); ImWidth = img.Width; hypster_tv_DAL.VisualSearch visSearch = new hypster_tv_DAL.VisualSearch(); visSearch.Artist_Name = name; visSearch.Genre_ID = genre_id; visSearch.ImWidth = ImWidth; visualSearchManager.addVisualSearch(visSearch); return(RedirectPermanent("/WebsiteManagement/hypArtists")); } hypster_admin.Areas.WebsiteManagement.ViewModels.hypArtistsViewModel model = new ViewModels.hypArtistsViewModel(); ViewBag.Value = "Already Exist"; return(View("Index", model)); } else { return(RedirectPermanent("/home/")); } }
// // GET: /WebsiteManagement/hypArtists/ public ActionResult Index() { if (Session["Roles"] != null && Session["Roles"].Equals("Admin")) { hypster_tv_DAL.MemberMusicGenreManager genreManager = new hypster_tv_DAL.MemberMusicGenreManager(); hypster_tv_DAL.visualSearchManager visSearchManager = new hypster_tv_DAL.visualSearchManager(); hypster_admin.Areas.WebsiteManagement.ViewModels.hypArtistsViewModel model = new ViewModels.hypArtistsViewModel(); model.genres = genreManager.GetMusicGenresList(); model.visualSearch = visSearchManager.getVisualSearchArtists(); return(View(model)); } else { return(RedirectPermanent("/home/")); } }