This commit is contained in:
2019-04-30 19:41:00 +00:00
parent 0be48bebb3
commit ae791ec366
20 changed files with 63 additions and 55 deletions

View File

@@ -3,17 +3,25 @@ namespace AyaNova.Api.ControllerHelpers
{
public class ApiOkResponse
//return the response with optional readonly flag
//this exists basically for consistency and to reduce the bandwidth if not readonly which is most common
public static class ApiOkResponse
{
public object Data { get; }
public bool ReadOnly {get;}
public ApiOkResponse(object result, bool isReadOnly)
public static object Response(object result, bool isReadOnly)
{
Data = result;
ReadOnly=isReadOnly;
if (isReadOnly)
{
return new
{
Data = result,
ReadOnly = true
};
}
else
{
return new { Data = result };
}
}
}//eoc