Skip to content

aecceyhan/GenericResponse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generic Response

Generic Response for .net projects

Installing

  Install-Package Ceyhan.GenericResponse -Version 1.0.0

Usage

  using GenericResponse;

Return success

  public static GenericResponse<User> FakeService(User user)
  {
     return new GenericResponse<User>(user);
  }

Return fail

  public static GenericResponse<User> FakeService(User user)
  {
     return new GenericResponse<User>("Something happend");
  }

Check methods response

  var userRegisterResponse = RegisterNewUser(user);


  if (userRegisterResponse.Success)
  {
     Console.WriteLine($"User {userRegisterResponse.GenericModel.Name} is successfully registered");
  }
  else
  {
     Console.WriteLine($"Log error - {userRegisterResponse.Message}");
  }

For interfaces;

 public interface IUserService
 {
     Task<GenericResponse<User>> Logout(string token);
 }

TODO

  • Add more examples
  • Publish as a nuget pack

Licensing

This project is licensed under MIT license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages