public IssueGetResponse UpdateIssue(int Id, IssuePutRequest Issue) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); User author = _userManager.CurrentUser; return(connection .Query <IssueGetResponse>( "EXEC [Support-API].[dbo].[SP_Update_Issue] @Id = @Id, @Subject = @Subject, @Priority = @Priority, @Category = @Category, @Department = @Department, @Author = @Author, @Status = @Status", new { Id = Id, Subject = Issue.Subject, Priority = Issue.Priority, Category = Issue.Category, Department = Issue.Department, Author = author.UUID, Status = Issue.Status } ).FirstOrDefault()); } }
public IActionResult UpdateIssue(int Id, [FromBody] IssuePutRequest Issue) { if (_userManager.CurrentUser == null) { return(Unauthorized()); } IssueGetResponse updatedIssue = _dataRepository.UpdateIssue(Id, Issue); if (updatedIssue != null) { return(Ok(updatedIssue)); } else { return(NotFound()); } }