/// <summary> /// Deprecated Method for adding a new object to the DesignerContantImage EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDesignerContantImage(DesignerContantImage designerContantImage) { base.AddObject("DesignerContantImage", designerContantImage); }
/// <summary> /// Create a new DesignerContantImage object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="designerContentId">Initial value of the DesignerContentId property.</param> /// <param name="imageSource">Initial value of the ImageSource property.</param> public static DesignerContantImage CreateDesignerContantImage(global::System.Int32 id, global::System.Int32 designerContentId, global::System.String imageSource) { DesignerContantImage designerContantImage = new DesignerContantImage(); designerContantImage.Id = id; designerContantImage.DesignerContentId = designerContentId; designerContantImage.ImageSource = imageSource; return designerContantImage; }
public ActionResult EditRoom(DesignerContent model) { using (var context = new PortfolioContainer()) { var dc = context.DesignerContent.Include("Designer").First(d => d.Id == model.Id); dc.Description = HttpUtility.HtmlDecode(model.Description); dc.RoomTitle = model.RoomTitle; 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 dci = new DesignerContantImage(); 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); dci.ImageSource = fileName; dc.DesignerContantImages.Add(dci); } context.SaveChanges(); return RedirectToAction("RoomDetails", "Designer", new { area = "DesignersPortfolio", id = dc.Designer.Name, roomType = dc.RoomType }); } }