PandaTech.ServiceResponse
1.1.0
See the version list below for details.
dotnet add package PandaTech.ServiceResponse --version 1.1.0
NuGet\Install-Package PandaTech.ServiceResponse -Version 1.1.0
<PackageReference Include="PandaTech.ServiceResponse" Version="1.1.0" />
paket add PandaTech.ServiceResponse --version 1.1.0
#r "nuget: PandaTech.ServiceResponse, 1.1.0"
// Install PandaTech.ServiceResponse as a Cake Addin #addin nuget:?package=PandaTech.ServiceResponse&version=1.1.0 // Install PandaTech.ServiceResponse as a Cake Tool #tool nuget:?package=PandaTech.ServiceResponse&version=1.1.0
ServiceResponse
Intro
This is service response template for .NET 6, 7 web api projects. This template is based on the best practices and has goal to harmonize all API I/O operations. The benefit of this template over other templates is that it totally integrates with OpenAPI and Swagger. So, IActionResults and other services, response will be visible in Swagger UI and loads of other features are and is going to be included.
This Template is designed by PandaTech LLC. We build software with the greatest quality! Our website: www.pandatech.it 😃
Example
Model
public class Blog
{
public int BlogId { get; set; }
public string BlogName { get; set; }
public string BlogDescription { get; set; }
}
public class Post
{
public int PostId { get; set; }
public string PostName { get; set; }
public string PostDescription { get; set; }
public Blog Blog { get; set; }
}
Service
public class Services : Handler
{
public ServiceResponse DeletePost(int postId)
{
var serviceResponse = new ServiceResponse();
try
{
if (postId == 0) // just for example, cannot be in real case
{
serviceResponse.ResponseStatus = ServiceResponseStatus.NotFound;
serviceResponse.Message = $"PostId is with number {postId} not found";
serviceResponse.Success = false;
}
//Delete post logic for serviceResponse
}
catch (Exception serviceException)
{
ExceptionHandler(serviceResponse, serviceException);
}
return serviceResponse;
}
public ServiceResponse<Post> GetPost(int postId)
{
var serviceResponse = new ServiceResponse<Post>();
try
{
//Get post logic for serviceResponse
}
catch (Exception serviceException)
{
ExceptionHandler(serviceResponse, serviceException);
}
return serviceResponse;
}
public ServiceResponsePaged<List<Blog>> GetAllBlogs(int page, int pagesize)
{
var serviceResponse = new ServiceResponsePaged<List<Blog>>();
try
{
//get all blogs logic with pagination for serviceResponse
}
catch (Exception serviceException)
{
ExceptionHandler(serviceResponse, serviceException);
}
return serviceResponse;
}
}
Controller
public class Controller : ExtendedController
{
[HttpDelete("Post")]
public ServiceResponse DeletePost(int postId)
{
var serviceResponse = DeletePost(postId);
return SetResponse(serviceResponse);
}
[HttpGet("Post")]
public ServiceResponse<Post> GetPost(int postId)
{
var serviceResponse = GetPost(postId);
return SetResponse(serviceResponse);
}
[HttpGet("Blogs")]
public ServiceResponsePaged<List<Blog>> GetAllBlogs(int page, int pagesize)
{
var serviceResponse = GetAllBlogs(page, pagesize);
return SetResponse(serviceResponse);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PandaTech.ServiceResponse:
Package | Downloads |
---|---|
Pandatech.ResponseCrafter
Handling exceptions, custom Dtos. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.2 | 108 | 11/23/2024 |
2.0.1 | 74 | 11/23/2024 |
2.0.0 | 108 | 11/21/2024 |
1.2.10 | 152 | 10/20/2023 |
1.2.9 | 148 | 10/20/2023 |
1.2.8 | 211 | 9/11/2023 |
1.2.7 | 142 | 9/6/2023 |
1.2.6 | 178 | 8/14/2023 |
1.2.5 | 192 | 8/14/2023 |
1.2.4 | 151 | 8/14/2023 |
1.2.3 | 146 | 8/9/2023 |
1.2.2 | 164 | 7/20/2023 |
1.2.1 | 190 | 6/13/2023 |
1.1.9 | 177 | 6/6/2023 |
1.1.8 | 161 | 6/2/2023 |
1.1.7 | 132 | 6/2/2023 |
1.1.6 | 127 | 6/2/2023 |
1.1.5 | 145 | 5/26/2023 |
1.1.4 | 353 | 4/5/2023 |
1.1.3 | 269 | 3/18/2023 |
1.1.2 | 213 | 3/17/2023 |
1.1.1 | 238 | 3/17/2023 |
1.1.0 | 222 | 3/16/2023 |
1.0.0 | 234 | 2/14/2023 |
This is our first stable release!