Skip to content

Latest commit

 

History

History
79 lines (48 loc) · 1.02 KB

README.md

File metadata and controls

79 lines (48 loc) · 1.02 KB

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.