Esempio n. 1
0
        private void Include(WorkItemDto workItemDto)
        {
            using (var db = new GetWorkItemContext()) {
                var newWorkItem = FillWorkItem(workItemDto);

                db.WorkItems.Add(newWorkItem);
                db.SaveChanges();
            }
        }
Esempio n. 2
0
        private void Include(ConfigurationDto configurationDto)
        {
            using (var db = new GetWorkItemContext()) {
                var newConfiguration = FillConfiguration(configurationDto);

                db.Configurations.Add(newConfiguration);
                db.SaveChanges();
            }
        }
Esempio n. 3
0
        private void Edit(WorkItemDto workItemDto)
        {
            using (var db = new GetWorkItemContext()) {
                var workItemOriginal = db.WorkItems.FirstOrDefault(w => w.Id == workItemDto.Id);
                workItemOriginal.WorkItemType = workItemDto.WorkItemType;
                workItemOriginal.Title        = workItemDto.Title;
                workItemOriginal.CreatedDate  = workItemDto.CreatedDate;

                db.SaveChanges();
            }
        }
Esempio n. 4
0
        private void Edit(ConfigurationDto configurationDto)
        {
            using (var db = new GetWorkItemContext()) {
                var configurationOriginal = db.Configurations.FirstOrDefault();
                configurationOriginal.Url         = configurationDto.Url;
                configurationOriginal.Token       = configurationDto.Token;
                configurationOriginal.ProjectName = configurationDto.ProjectName;

                db.SaveChanges();
            }
        }
Esempio n. 5
0
 public ActionResult <ConfigurationReturn> GetConfiguration()
 {
     using (var db = new GetWorkItemContext()) {
         return(db.Configurations
                .Select(c => new ConfigurationReturn {
             Url = c.Url,
             ProjectName = c.ProjectName,
             Token = c.Token
         })
                .FirstOrDefault());
     }
 }
Esempio n. 6
0
 public ActionResult <WorkItemReturn[]> GetWorkItems()
 {
     using (var db = new GetWorkItemContext()) {
         return(db.WorkItems
                .Select(w => new WorkItemReturn {
             Id = w.Id,
             Title = w.Title,
             CreatedDate = w.CreatedDate,
             WorkItemType = w.WorkItemType
         })
                .ToArray());
     }
 }
Esempio n. 7
0
        private void FillIdsWorkItems(WorkItemDto[] worksItemsDto)
        {
            using (var db = new GetWorkItemContext()) {
                var workItems = db.WorkItems
                                .Select(w => new {
                    w.Id,
                    w.IdWorkItem
                })
                                .ToArray();

                foreach (var workItemDto in worksItemsDto)
                {
                    workItemDto.Id = workItems
                                     .Where(w => w.IdWorkItem == workItemDto.IdWorkItem)
                                     .Select(w => w.Id)
                                     .FirstOrDefault();
                }
            }
        }
Esempio n. 8
0
 private bool CheckConfiguration()
 {
     using (var db = new GetWorkItemContext()) {
         return(db.Configurations.FirstOrDefault() != null);
     }
 }