-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve some missing convention.
- Loading branch information
Showing
10 changed files
with
83 additions
and
39 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
Source/BSN.Commons.PresentationInfrastructure/BSN.Commons.PresentationInfrastructure.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 28 additions & 24 deletions
52
Source/BSN.Commons.PresentationInfrastructure/ResponseBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
|
||
namespace BSN.Commons.PresentationInfrastructure | ||
{ | ||
public class ResponseBase : IResponse<ValidationResult> | ||
{ | ||
/// <summary> | ||
/// Gets a value that indicates whether the HTTP response was successful. | ||
/// </summary> | ||
/// <remarks> | ||
/// If the server doesn't return a successful HttpStatusCode in the Successful range (200-299) for the request, then the responseObject.IsSuccess property is set to false | ||
/// </remarks> | ||
/// More info: https://docs.microsoft.com/en-us/uwp/api/windows.web.http.httpresponsemessage.issuccessstatuscode?view=winrt-19041 | ||
public bool IsSuccess => (int)StatusCode >= 200 && (int)StatusCode <= 299; | ||
|
||
public string Message { get; set; } | ||
|
||
public ResponseStatusCode StatusCode { get; set; } | ||
|
||
public IList<ValidationResult> InvalidItems { get; set; } | ||
} | ||
} | ||
using BSN.Commons.Converters; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace BSN.Commons.PresentationInfrastructure | ||
{ | ||
[Obsolete("Due to incompatability with Grpc this response type is only used for backward compatibility.")] | ||
public class ResponseBase : IResponse<ValidationResult> | ||
{ | ||
/// <summary> | ||
/// Gets a value that indicates whether the HTTP response was successful. | ||
/// </summary> | ||
/// <remarks> | ||
/// If the server doesn't return a successful HttpStatusCode in the Successful range (200-299) for the request, then the responseObject.IsSuccess property is set to false | ||
/// </remarks> | ||
/// More info: https://docs.microsoft.com/en-us/uwp/api/windows.web.http.httpresponsemessage.issuccessstatuscode?view=winrt-19041 | ||
public bool IsSuccess => (int)StatusCode >= 200 && (int)StatusCode <= 299; | ||
|
||
public string Message { get; set; } | ||
|
||
[JsonConverter(typeof(JsonForceDefaultConverter<ResponseStatusCode>))] | ||
public ResponseStatusCode StatusCode { get; set; } | ||
|
||
public IList<ValidationResult> InvalidItems { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Source/BSN.Commons.PresentationInfrastructure/Responses/CollectionViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace BSN.Commons.Responses | ||
{ | ||
/// <summary> | ||
/// Collection schema for generating responses.. | ||
/// </summary> | ||
/// <typeparam name="T">Elements type.</typeparam> | ||
[DataContract] | ||
public class CollectionViewModel<T> | ||
{ | ||
public CollectionViewModel() { } | ||
|
||
/// <summary> | ||
/// Elements. | ||
/// </summary> | ||
[DataMember(Order = 1)] | ||
public IEnumerable<T> Items { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters