コード例 #1
0
ファイル: SliderController.cs プロジェクト: fathurxzz/aleqx
 public ActionResult Create(FormCollection form)
 {
     var slider = new Slider();
     TryUpdateModel(slider, new[] {"Url"});
     if (Request.Files["banner"] != null && !string.IsNullOrEmpty(Request.Files["banner"].FileName))
     {
         string fileName = IOHelper.GetUniqueFileName("~/Content/Images", Request.Files["banner"].FileName);
         string filePath = Server.MapPath("~/Content/Images");
         filePath = Path.Combine(filePath, fileName);
         Request.Files["banner"].SaveAs(filePath);
         slider.ImageSource = fileName;
     }
     _context.AddToSlider(slider);
     _context.SaveChanges();
     return RedirectToAction("Index", "Slider", new { area = "Admin" });
 }
コード例 #2
0
ファイル: Site.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Deprecated Method for adding a new object to the Slider EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSlider(Slider slider)
 {
     base.AddObject("Slider", slider);
 }
コード例 #3
0
ファイル: Site.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Create a new Slider object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="url">Initial value of the Url property.</param>
 /// <param name="imageSource">Initial value of the ImageSource property.</param>
 public static Slider CreateSlider(global::System.Int32 id, global::System.String url, global::System.String imageSource)
 {
     Slider slider = new Slider();
     slider.Id = id;
     slider.Url = url;
     slider.ImageSource = imageSource;
     return slider;
 }