Ejemplo n.º 1
0
        public ActionResult Create(NewListingView list, FormCollection collection)
        {
            int ProptyId = o.MainInsert(list, collection);

            for (int i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i];

                if (ModelState.IsValid)
                {
                    if (file != null && file.ContentLength > 0)
                    {
                        int BlobIds = JazMax.Core.Blob.BlobStorageService.UploadToBlob("testimge", "test", file);

                        PropertyImagesView table = new PropertyImagesView()
                        {
                            BlobId            = BlobIds,
                            PropertyListingId = ProptyId,
                        };

                        o.CapturePropertyImages(table, ProptyId);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public void CapturePropertyImages(PropertyImagesView model, int PropertyListingId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyImage table = new DataAccess.PropertyImage()
                    {
                        PropertyImagesId  = model.PropertyImagesId,
                        PropertyListingId = PropertyListingId,
                        BlobId            = model.BlobId,
                        IsActive          = model.IsActive
                    };

                    db.PropertyImages.Add(table);
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }