private void Include(WorkItemDto workItemDto) { using (var db = new GetWorkItemContext()) { var newWorkItem = FillWorkItem(workItemDto); db.WorkItems.Add(newWorkItem); db.SaveChanges(); } }
private void Include(ConfigurationDto configurationDto) { using (var db = new GetWorkItemContext()) { var newConfiguration = FillConfiguration(configurationDto); db.Configurations.Add(newConfiguration); db.SaveChanges(); } }
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(); } }
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(); } }
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()); } }
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()); } }
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(); } } }
private bool CheckConfiguration() { using (var db = new GetWorkItemContext()) { return(db.Configurations.FirstOrDefault() != null); } }