Exemplo n.º 1
0
 /// <summary>
 /// Create a new DesignerContent object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="designerId">Initial value of the DesignerId property.</param>
 /// <param name="roomType">Initial value of the RoomType property.</param>
 /// <param name="roomTitle">Initial value of the RoomTitle property.</param>
 public static DesignerContent CreateDesignerContent(global::System.Int32 id, global::System.Int32 designerId, global::System.Int32 roomType, global::System.String roomTitle)
 {
     DesignerContent designerContent = new DesignerContent();
     designerContent.Id = id;
     designerContent.DesignerId = designerId;
     designerContent.RoomType = roomType;
     designerContent.RoomTitle = roomTitle;
     return designerContent;
 }
Exemplo n.º 2
0
        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 });
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the DesignerContent EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDesignerContent(DesignerContent designerContent)
 {
     base.AddObject("DesignerContent", designerContent);
 }
Exemplo n.º 4
0
        public ActionResult CreateRoom(int id, int roomType)
        {
            using (var context = new PortfolioContainer())
            {
                var designer = context.Designer.First(d => d.Id == id);

                var dc = new DesignerContent
                         {
                             Designer = designer,
                             RoomType = roomType
                         };

                return View(dc);
            }
        }