private void AddWorkItemCategory(object argument) { var category = new WorkItemCategory { Name = "New Category" }; this.SelectedWorkItemCategoryList.Categories.Add(category); this.SelectedWorkItemCategory = category; }
public async Task <IActionResult> GetById(Guid id) { WorkItemCategory workItemCategory = await _repository.GetByIdAsync(id); if (workItemCategory == null) { return(NotFound()); } return(Ok(_mapper.Map(workItemCategory))); }
public async Task <IActionResult> Post(WorkItemCategoryRequest request) { try { WorkItemCategory workItemCategory = _mapper.Map(request); workItemCategory = await _repository.AddAsync(workItemCategory); return(CreatedAtAction(nameof(GetById), new { id = workItemCategory.Id }, _mapper.Map(workItemCategory))); } catch (DataStoreException e) { _logger.LogError(e.Message, e, request); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public async Task <IActionResult> Delete(Guid id) { try { WorkItemCategory workItemCategory = await _repository.GetByIdAsync(id); if (workItemCategory == null) { return(NotFound()); } await _repository.DeleteAsync(workItemCategory); return(Ok(id)); } catch (DataStoreException e) { _logger.LogError(e.Message, e, id); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public async Task <IActionResult> Put(Guid id, WorkItemCategoryRequest request) { try { WorkItemCategory workItemCategory = await _repository.GetByIdAsync(id); if (workItemCategory == null) { return(NotFound()); } _mapper.Map(workItemCategory, request); await _repository.UpdateAsync(workItemCategory); return(Ok()); } catch (DataStoreException e) { _logger.LogError(e.Message, e, request); return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public WorkItemCategoryInfo(string teamProject, WorkItemCategoryList workItemCategoryList, WorkItemCategory workItemCategory) { this.TeamProject = teamProject; this.WorkItemCategoryList = workItemCategoryList; this.WorkItemCategory = workItemCategory; this.WorkItemTypeNames = (this.WorkItemCategory == null || this.WorkItemCategory.WorkItemTypes == null) ? null : string.Join(", ", this.WorkItemCategory.WorkItemTypes.Select(s => s.Name)); }