Beispiel #1
0
 public EvidenceDb(Evidence e)
 {
     this.CustomerID = e.CustomerID;
     this.ChallengeID = e.ChallengeID;
     this.Type = e.Type;
     this.MediaURL = e.MediaURL;
     this.UniqueID = e.UniqueID;
     this.Content = e.Content;
 }
Beispiel #2
0
        public EvidenceDb(Evidence e)
        {
            this.PartitionKey = e.ChallengeStatusID;
            this.RowKey = e.UniqueID;

            this.Type = e.Type;
            this.MediaURL = e.MediaURL;
            this.UniqueID = e.UniqueID;
            this.Content = e.Content;
        }
        private Evidence DbEvidenceToEvidence(EvidenceDb item)
        {
            Evidence e = new Evidence();

            e.ChallengeStatusID = item.ChallengeStatusID;
            e.MediaURL = item.MediaURL;
            e.Type = item.Type;
            e.UniqueID = item.UniqueID;
            e.Content = item.Content;

            return e;
        }
        public void Add(Evidence e)
        {
            EvidenceDb d = EvidenceToDbEvidence(e);

            d.PartitionKey = DbPartKey(e.ChallengeID, e.CustomerID);
            d.RowKey = e.UniqueID;

            context.AttachTo(TableName, d, null);
            context.UpdateObject(d);
            context.SaveChangesWithRetries();
            context.Detach(d);
        }
        private EvidenceDb EvidenceToDbEvidence(Evidence item)
        {
            EvidenceDb d = new EvidenceDb();

            d.CustomerID = item.CustomerID;
            d.Content = item.Content;
            d.MediaURL = item.MediaURL;
            d.UniqueID = item.UniqueID;
            d.Type = item.Type;
            d.ChallengeID = item.ChallengeID;

            return d;
        }
        public void Post(Evidence value)
        {
            if (value.ChallengeID == 0)
                throw new HttpResponseException("You have to supply a challenge ID.", System.Net.HttpStatusCode.Forbidden);

            if (value.Content == null)
                value.Content = "";

            if (value.MediaURL == null)
                value.MediaURL = "";

            value.UniqueID = System.Guid.NewGuid().ToString();

            EvidenceRepo.Add(value);
        }
        private EvidenceDb EvidenceToDbEvidence(Evidence item)
        {
            EvidenceDb d = new EvidenceDb();

            d.ChallengeStatusID = item.ChallengeStatusID;
            d.Content = item.Content;
            d.MediaURL = item.MediaURL;
            d.UniqueID = item.UniqueID;
            d.Type = item.Type;
            d.ChallengeID = item.ChallengeID;

            d.PartitionKey = item.ChallengeID + "_" + item.UniqueID;
            d.RowKey = item.UniqueID;

            return d;
        }
 public void Add(Evidence e)
 {
     EvidenceDb d = EvidenceToDbEvidence(e);
     context.AttachTo(TableName, d);
     context.SaveChangesWithRetries();
 }