Example #1
0
        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" });
        }
Example #2
0
 /// <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);
 }
Example #3
0
 /// <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;
 }