private static bool ValidateResponse(Model.Response.AuthorResponse response)
 {
     if (!string.IsNullOrEmpty(response.message))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public static Model.Response.AuthorResponse Create(Model.Entities.AuthorEntity 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>("createAuthor_InsertCommand", request);
         response.authorEntity = listAuthors;
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
Ejemplo n.º 3
0
 public static Model.Response.AuthorResponse GetAll()
 {
     Model.Response.AuthorResponse response = new Model.Response.AuthorResponse();
     try
     {
         var dataservice = new Connection.DbContext();
         List <Model.Entities.AuthorEntity> listAuthors = dataservice.GetList <Model.Entities.AuthorEntity, object>("getAuthors_SelectCommand");
         response.authorEntity = listAuthors;
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
 public static Model.Response.AuthorResponse GetAll()
 {
     Model.Response.AuthorResponse response = new Model.Response.AuthorResponse();
     try
     {
         response = Data.AuthorData.GetAll();
         if (ValidateResponse(response))
         {
             response.code    = 100;
             response.message = "Success";
         }
     }
     catch (Exception ex)
     {
         response.code    = 500;
         response.message = ex.Message;
     }
     return(response);
 }
 public ActionResult <Model.Response.AuthorResponse> GetAuthorById(Model.Request.AuthorRequest request)
 {
     Model.Response.AuthorResponse response = Business.AuthorBusiness.GetAuthorById(request);
     return(response);
 }
 public ActionResult <Model.Response.AuthorResponse> GetAll()
 {
     Model.Response.AuthorResponse response = Business.AuthorBusiness.GetAll();
     return(response);
 }