示例#1
0
        public Guid AddStorageArea(DocumentStorageArea StorageArea)
        {
            StorageArea.IdStorageArea = Guid.NewGuid();

            using (Model.BiblosDS2010Entities db = new Model.BiblosDS2010Entities(BiblosDSConnectionString))
            {
                Model.StorageArea entityAttribute = StorageArea.TryToConvertTo <Model.StorageArea>(false);

                if (StorageArea.Status != null && StorageArea.Status.IdStatus > 0)
                {
                    entityAttribute.IdStorageStatus = StorageArea.Status.IdStatus;
                }

                if (StorageArea.Storage != null)
                {
                    entityAttribute.IdStorage = StorageArea.Storage.IdStorage;
                }

                if (StorageArea.Archive != null)
                {
                    entityAttribute.IdArchive = StorageArea.Archive.IdArchive;
                }

                db.AddToStorageArea(entityAttribute);
                db.SaveChanges();
            }

            return(StorageArea.IdStorageArea);
        }