コード例 #1
0
        /*public void WorkItemAWSPost()
        {
            var wif = new dalewilbanks.net.factories.WorkItemFactoryAWS(
            System.Configuration.ConfigurationManager.AppSettings["AWSAccessKey"],
            System.Configuration.ConfigurationManager.AppSettings["AWSSecretKey"]);

            int workItemID = 0;
            Int32.TryParse(Request["WorkItemID"], out workItemID);

            if (workItemID != 0)
            {
                var workItem = new dalewilbanks.net.entities.WorkItem() { WorkItemID = workItemID, Name = Request["Name"], Type = Request["Type"], Description = Request["Description"], Attachments = Request["Attachments"], EnteredBy = Request["EnteredBy"], EntryDate = Request["EntryDate"] };
                wif.Save(workItem);
            }
        }*/

        public void WorkItemEFPost()
        {
            var workItemsContext = new WorkItemContext();

            var workItem = new dalewilbanks.net.entities.WorkItem() { Name = Request["Name"], Type = Request["Type"], Description = Request["Description"], Attachments = String.Empty, EnteredBy = Request["EnteredBy"], EntryDate = Request["EntryDate"] };
            workItemsContext.WorkItems.Add(workItem);
            workItemsContext.SaveChanges();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Database.SetInitializer<WorkItemContext>(new CreateDatabaseIfNotExists<WorkItemContext>());

            var workItems = new WorkItemContext();

            workItems.WorkItems.Add(new WorkItem { Attachments = "none", Description = "description 2", EnteredBy = "dale wilbanks", EntryDate = DateTime.Now.ToString(), Name = "Second EF work item", Type = "Bug" });

            workItems.SaveChanges();
        }
コード例 #3
0
        public List<WorkItem> GetCollection()  //changed return type to IEnumerable<WorkItem> from List<WorkItem>, doesn't seem to be liked by WCF service though
        {

            var workItemContext = new WorkItemContext();

            //added this copy as a workaround
            var workItems = new List<WorkItem>();

            foreach (WorkItem workItem in workItemContext.WorkItems)
            {
                workItems.Add(workItem);
            }

            return workItems;
        }