コード例 #1
0
 private static bool ValidateRequest(Model.Request.AuthorRequest request)
 {
     Model.Response.CodeResponse codeResponse = new Model.Response.CodeResponse();
     if (request.idAuthor < 0)
     {
         codeResponse.code    = 101;
         codeResponse.message = "ID Number invalid";
         return(false);
     }
     return(true);
 }
コード例 #2
0
 public static Model.Response.AuthorResponse GetAuthorById(Model.Request.AuthorRequest request)
 {
     Model.Response.AuthorResponse response = new Model.Response.AuthorResponse();
     try
     {
         var dataservice = new Connection.DbContext();
         List <Model.Entities.AuthorEntity> listAuthors = dataservice.GetListByParameter <Model.Entities.AuthorEntity, object>("getAuthorsById_SelectCommand", request);
         response.authorEntity = listAuthors;
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
コード例 #3
0
 public static Model.Response.AuthorResponse GetAuthorById(Model.Request.AuthorRequest request)
 {
     Model.Response.AuthorResponse response = new Model.Response.AuthorResponse();
     try
     {
         if (ValidateRequest(request))
         {
             response = Data.AuthorData.GetAuthorById(request);
             if (ValidateResponse(response))
             {
                 response.code    = 100;
                 response.message = "Success";
             }
         }
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
コード例 #4
0
 public ActionResult <Model.Response.AuthorResponse> GetAuthorById(Model.Request.AuthorRequest request)
 {
     Model.Response.AuthorResponse response = Business.AuthorBusiness.GetAuthorById(request);
     return(response);
 }