コード例 #1
0
        public ActionResult Create(FormCollection form, HttpPostedFileBase fileUpload)
        {
            using (var context = new ContentStorage())
            {
                if (fileUpload != null)
                {
                    string fileName = IOHelper.GetUniqueFileName("~/Content/ActualTours", fileUpload.FileName);
                    string filePath = Server.MapPath("~/Content/ActualTours");
                    filePath = Path.Combine(filePath, fileName);
                    fileUpload.SaveAs(filePath);

                    var tour = new ActualTours();
                    TryUpdateModel(tour, new[] { "Price", "Title", "Description", "Sign1", "Sign2", "Sign3", "Sign4", "Sign5" });
                    tour.Text = HttpUtility.HtmlDecode(form["Text"]);
                    tour.ImageSource = fileName;
                    context.AddToActualTours(tour);
                    context.SaveChanges();
                }

            }
            return RedirectToAction("Index", "Home", new { Area = "", id = "" });
        }
コード例 #2
0
ファイル: Model.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Create a new ActualTours object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="imageSource">Initial value of the ImageSource property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="text">Initial value of the Text property.</param>
 public static ActualTours CreateActualTours(global::System.Int32 id, global::System.String title, global::System.String imageSource, global::System.String description, global::System.String text)
 {
     ActualTours actualTours = new ActualTours();
     actualTours.Id = id;
     actualTours.Title = title;
     actualTours.ImageSource = imageSource;
     actualTours.Description = description;
     actualTours.Text = text;
     return actualTours;
 }
コード例 #3
0
ファイル: Model.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Deprecated Method for adding a new object to the ActualTours EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToActualTours(ActualTours actualTours)
 {
     base.AddObject("ActualTours", actualTours);
 }