示例#1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the BuildingImage EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBuildingImage(BuildingImage buildingImage)
 {
     base.AddObject("BuildingImage", buildingImage);
 }
示例#2
0
        public ActionResult AddImage(int id, FormCollection form)
        {
            var bo = _context.BuildingObj.First(t => t.Id == id);
            for (int i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i];

                if (file == null) continue;
                if (string.IsNullOrEmpty(file.FileName)) continue;

                var title = form["title[" + i + "]"];

                var bi = new BuildingImage{Title = title};
                string fileName = IOHelper.GetUniqueFileName("~/Content/Images", file.FileName);
                string filePath = Server.MapPath("~/Content/Images");

                filePath = Path.Combine(filePath, fileName);
                //GraphicsHelper.SaveOriginalImage(filePath, fileName, file, 1500);
                file.SaveAs(filePath);

                bi.ImageSource = fileName;

                bo.BuildingImages.Add(bi);

                _context.SaveChanges();
            }

            return RedirectToAction("Buildings", "Home", new { area = "" });
        }
示例#3
0
 /// <summary>
 /// Create a new BuildingImage object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="buildingObjId">Initial value of the BuildingObjId property.</param>
 /// <param name="imageSource">Initial value of the ImageSource property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 public static BuildingImage CreateBuildingImage(global::System.Int32 id, global::System.Int32 buildingObjId, global::System.String imageSource, global::System.String title)
 {
     BuildingImage buildingImage = new BuildingImage();
     buildingImage.Id = id;
     buildingImage.BuildingObjId = buildingObjId;
     buildingImage.ImageSource = imageSource;
     buildingImage.Title = title;
     return buildingImage;
 }