public async Task ChangeInvalidIssueTest() { var dto = new ChangeStatusDto { IssueId = "IssueHelper.ValidIssue.Id", StatusId = StatusHelper.ValidStatus.Id }; Assert.ThrowsAsync <NotFoundException>(async() => await _issueService.ChangeStatus(dto)); }
public async Task ChangeValidStatusTest() { var dto = new ChangeStatusDto { IssueId = IssueHelper.ValidIssue.Id, StatusId = StatusHelper.ValidStatus.Id }; var result = await _issueService.ChangeStatus(dto); Assert.AreEqual(dto.StatusId, result.StatusId); }
public async Task <ToDo> UpdateTaskStatus([FromRoute] int id, [FromBody] ChangeStatusDto statusDto) { bool status = statusDto.Status; var todo = await _repository.SetToDoStatusById(id, status); if (status) { _scheduler.DelayToDo(id); } return(todo); }
public IActionResult SubmitOrder([FromBody] ChangeStatusDto changeStatusDto) { try { _orderService.ChangeStatus(changeStatusDto.OrderId, changeStatusDto.Status); return(Ok()); } catch (AppException ex) { return(BadRequest(ex.Message)); } }
public async Task <Contract.Models.Issue> ChangeStatus(ChangeStatusDto changeStatusDto) { ValidationHelper.ValidateAndThrow(changeStatusDto); if (!await _issueGetOperations.ExistsById(changeStatusDto.IssueId)) { throw new NotFoundException("Задача не найдена"); } if (!await _taskStatusGetOperations.ExistsById(changeStatusDto.StatusId)) { throw new NotFoundException("Статус не найдена"); } return(await _issueWriteOperations.UpdateStatus(changeStatusDto.IssueId, changeStatusDto.StatusId)); }
public async Task <IActionResult> ChangeStatus(int id, ChangeStatusDto changeStatus) { var order = await warehouseRepository.GetOrder(id); if (order == null) { return(NotFound()); } mapper.Map(changeStatus, order); if (await warehouseRepository.SaveAll()) { return(Ok()); } return(BadRequest("Nie udało się zmienić statusu.")); }
/// <summary> /// Change status of Information content. /// </summary> /// <param name="body">The request to change content status.</param> /// <param name="id">The id of the Information content.</param> /// <returns>InformationContentDto</returns> public InformationContentDto ChangeInformationContentStatus(ChangeStatusDto body, string id) { // verify the required parameter 'body' is set if (body == null) { throw new ApiException(400, "Missing required parameter 'body' when calling ChangeInformationContentStatus"); } // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling ChangeInformationContentStatus"); } var path = "/content/mycv/information/{id}/status"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "id" + "}", ApiClient.ParameterToString(id)); var queryParams = new Dictionary <String, String>(); var headerParams = new Dictionary <String, String>(); var formParams = new Dictionary <String, String>(); var fileParams = new Dictionary <String, FileParameter>(); String postBody = null; postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "squidex-oauth-auth" }; // make the HTTP request IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException((int)response.StatusCode, "Error calling ChangeInformationContentStatus: " + response.Content, response.Content); } else if (((int)response.StatusCode) == 0) { throw new ApiException((int)response.StatusCode, "Error calling ChangeInformationContentStatus: " + response.ErrorMessage, response.ErrorMessage); } return((InformationContentDto)ApiClient.Deserialize(response.Content, typeof(InformationContentDto), response.Headers)); }
public async Task <IActionResult> PutContentStatus(string app, string name, DomainId id, ChangeStatusDto request) { var command = request.ToCommand(id); var response = await InvokeCommandAsync(command); return(Ok(response)); }
public async Task <IActionResult> PutContentStatus(string app, string name, Guid id, ChangeStatusDto request) { await contentQuery.GetSchemaOrThrowAsync(Context, name); var command = request.ToCommand(id); var response = await InvokeCommandAsync(command); return(Ok(response)); }
public async Task <IActionResult> PutContentStatus(string app, string name, Guid id, ChangeStatusDto request) { await contentQuery.GetSchemaOrThrowAsync(Context(), name); if (!this.HasPermission(Helper.StatusPermission(app, name, Status.Published))) { return(new ForbidResult()); } var command = request.ToCommand(id); var response = await InvokeCommandAsync(app, name, command); return(Ok(response)); }