コード例 #1
0
ファイル: BellboyController.cs プロジェクト: fathurxzz/aleqx
        public ActionResult Create(FormCollection form, HttpPostedFileBase fileUpload)
        {
            using (var context = new ContentStorage())
            {
                if (fileUpload != null)
                {
                    
                    string fileName = IOHelper.GetUniqueFileName("~/Content/Bellboy", fileUpload.FileName);
                    string filePath = Server.MapPath("~/Content/Bellboy");
                    filePath = Path.Combine(filePath, fileName);
                    fileUpload.SaveAs(filePath);
                    
                    var bellboy = new Bellboy();
                    TryUpdateModel(bellboy, new[] { "TopText", "TopLink", "BottomText", "BottomLink" });
                    bellboy.ImageSource = fileName;
                    context.AddToBellboy(bellboy);
                    context.SaveChanges();
                }

            }
            return RedirectToAction("Index", "Bellboy", new { Area = "Admin" });
        }
コード例 #2
0
ファイル: Model.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Deprecated Method for adding a new object to the Bellboy EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBellboy(Bellboy bellboy)
 {
     base.AddObject("Bellboy", bellboy);
 }
コード例 #3
0
ファイル: Model.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Create a new Bellboy object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Bellboy CreateBellboy(global::System.Int64 id)
 {
     Bellboy bellboy = new Bellboy();
     bellboy.Id = id;
     return bellboy;
 }