public IActionResult Put(int id, Collection pc)
        {
            if (id != pc.Id)
            {
                return(BadRequest());
            }

            _collectionRepository.Update(pc);
            return(NoContent());
        }
        public void UpdateCollectionDrug(int id)
        {
            using (var clinicrepo = new CollectionRepository())
            {
                CollectionDrugs find = clinicrepo.FindbyId(id);
                find.Collected = true;

                clinicrepo.Update(find);
            }
        }
Пример #3
0
        public void SetCoverPhoto(long photoId)
        {
            Photo      photo = PhotoEntityRepository.Single(p => p.ID == photoId, p => p.Site);
            Collection col   = CollectionRepository.Single(c => c.Site.ID == photo.Site.ID && c.Type == CollectionType.SITE);

            if (col != null)
            {
                col.CoverPhoto = photo;
                CollectionRepository.Update(col);
                Unit.Commit();
            }
        }
Пример #4
0
        public Collection GetCollectionForProcessing(XmlNode siteData)
        {
            string     siteName   = siteData["Folder"].InnerText;
            CameraSite site       = SiteRepository.Find(s => s.Name == siteName).FirstOrDefault();
            Collection collection = null;

            if (site == null)
            {
                site               = new CameraSite();
                site.Name          = siteData["Folder"].InnerText;
                site.DirectoryName = siteData["Folder"].InnerText;
                site.ContainerID   = Guid.NewGuid().ToString();
                if (siteData["Location"].Attributes["latitude"].Value != String.Empty)
                {
                    site.Latitude  = Convert.ToDouble(siteData["Location"].Attributes["latitude"].Value);
                    site.Longitude = Convert.ToDouble(siteData["Location"].Attributes["longitude"].Value);
                }

                var county = siteData["County"].InnerText;
                var state  = siteData["State"].InnerText;
                site.CountyFips = DMRepository.GetFipsForCountyAndState(county, state);

                collection = new Collection()
                {
                    ContainerID = site.ContainerID,
                    Name        = site.Name,
                    Site        = site,
                    Status      = CollectionStatus.PROCESSING,
                    Type        = CollectionType.SITE
                };

                CollectionRepository.Insert(collection);
                SiteRepository.Insert(site);
            }
            else
            {
                collection        = CollectionRepository.Find(c => c.Site.ID == site.ID).FirstOrDefault();
                collection.Status = CollectionStatus.PROCESSING;
                CollectionRepository.Update(collection);
            }

            return(collection);
        }
        public void User_Can_Edit_Collection()
        {
            // Instantiate CollectionRepo
            var repo = new CollectionRepository(_context);

            // Get an Collection from the Db
            var collectionToUpdate = repo.GetByCollectionId(1);

            collectionToUpdate.Collection.Name        = "You GOT UPDATED!";
            collectionToUpdate.Collection.Description = "AND YOU GOT UPDATED!";

            // Attempt to update
            repo.Update(collectionToUpdate.Collection);

            // Retrieve item from db to see if updates occurred
            var updatedCollection = repo.GetByCollectionId(1);

            // The new names should match
            Assert.True(updatedCollection.Collection.Name == collectionToUpdate.Collection.Name);
        }
Пример #6
0
 public void FinishCollectionProcessing(Collection collection)
 {
     collection.Status = CollectionStatus.COMPLETE;
     CollectionRepository.Update(collection);
 }