public ActionResult Create(Support pSupport) { try { GestionnaireSupports gestionnaireSupports = new GestionnaireSupports(); DataManager.ListeSupports = gestionnaireSupports.AjouterSupport(pSupport); return RedirectToAction("Index"); } catch (Exception ex) { HandleErrorInfo error = new HandleErrorInfo(ex, "Support", "Create"); return View("Error", error); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); GestionnaireGenres gestionnaireGenres = new GestionnaireGenres(); GestionnaireSupports gestionnaireSupports = new GestionnaireSupports(); GestionnaireProprietaires gestionnaireProprietaires = new GestionnaireProprietaires(); DataManager.ListeGenre = gestionnaireGenres.ObtenirGenres(); DataManager.ListeSupports = gestionnaireSupports.ObtenirSupports(); DataManager.ListeProprietaires = gestionnaireProprietaires.ObtenirProprietaires(); }
public ActionResult Edit(Support pSupport) { try { foreach (string inputTagName in Request.Files) { HttpPostedFileBase file = Request.Files[inputTagName]; //if (file.ContentLength > 0) //{ // string filePath = Path.Combine(HttpContext.Server.MapPath("../Uploads") // , Path.GetFileName(file.FileName)); // file.SaveAs(filePath); //} byte[] buffer = new byte[file.ContentLength]; file.InputStream.Read(buffer, 0, file.ContentLength); //ImageElement image = ImageElement.FromBinary(byteArray); pSupport.Icone = buffer; } if (Session["ContentStreamSupport"] != null) { pSupport.Icone = (byte[])Session["ContentStreamSupport"]; } GestionnaireSupports gestionnaireSupports = new GestionnaireSupports(); DataManager.ListeSupports = gestionnaireSupports.MettreAJourSupport(pSupport); return RedirectToAction("Index"); } catch (Exception ex) { HandleErrorInfo error = new HandleErrorInfo(ex, "Support", "Edit"); return View("Error", error); } }
public ActionResult Delete(String pCode, FormCollection collection) { try { GestionnaireSupports gestionnaireSupports = new GestionnaireSupports(); DataManager.ListeSupports = gestionnaireSupports.SupprimerSupport(pCode); return RedirectToAction("Index"); } catch (Exception ex) { HandleErrorInfo error = new HandleErrorInfo(ex, "Support", "Delete"); return View("Error", error); } }