Ejemplo n.º 1
0
 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/"));
     }
 }
Ejemplo n.º 2
0
 public ActionResult DeleteArtist(int id)
 {
     if (Session["Roles"] != null && Session["Roles"].Equals("Admin"))
     {
         hypster_tv_DAL.visualSearchManager visualSearchManager = new hypster_tv_DAL.visualSearchManager();
         hypster_tv_DAL.VisualSearch        artist = new hypster_tv_DAL.VisualSearch();
         artist = visualSearchManager.getVisualSearchArtistByID(id);
         visualSearchManager.DeleteArtist(id);
         System.IO.FileInfo file = new System.IO.FileInfo(System.Configuration.ConfigurationManager.AppSettings["visualSearchStorage_Path"] + "\\" + artist.Artist_Name + ".jpg");
         file.Delete();
         return(RedirectPermanent("/WebsiteManagement/hypArtists"));
     }
     else
     {
         return(RedirectPermanent("/home/"));
     }
 }