示例#1
0
 public RepositoryActionResult(object result = null, RepositoryActionStatus status = RepositoryActionStatus.BadRequest, Exception exception = null, string message = null)
 {
     Data      = result;
     Exception = exception;
     Message   = message;
     Status    = status;
 }
        private HttpStatusCode GetHttpStatusCode(RepositoryActionStatus repositoryActionResult)
        {
            switch (repositoryActionResult)
            {
            case RepositoryActionStatus.Ok: _repositoryResult.Success = true; return(HttpStatusCode.OK);

            case RepositoryActionStatus.Created: _repositoryResult.Success = true; return(HttpStatusCode.Created);

            case RepositoryActionStatus.Updated: _repositoryResult.Success = true; return(HttpStatusCode.Accepted);

            case RepositoryActionStatus.Deleted: _repositoryResult.Success = true; return(HttpStatusCode.NoContent);

            case RepositoryActionStatus.NotFound: _repositoryResult.Success = true; return(HttpStatusCode.NotFound);

            case RepositoryActionStatus.NothingModified: _repositoryResult.Success = false; return(HttpStatusCode.NotModified);

            case RepositoryActionStatus.Error: _repositoryResult.Success = false; return(HttpStatusCode.InternalServerError);

            case RepositoryActionStatus.BadRequest: _repositoryResult.Success = false; return(HttpStatusCode.BadRequest);

            default: _repositoryResult.Success = false; return(HttpStatusCode.BadGateway);
            }
        }
 public RepositoryActionResult(T entity, RepositoryActionStatus status, Exception exception) : this(entity, status)
 {
     Exception = exception;
 }
 public RepositoryActionResult(T entity, RepositoryActionStatus status)
 {
     Entity = entity;
     Status = status;
 }
示例#5
0
 public object ActionResult(T entity, RepositoryActionStatus status)
 {
     return(new RepositoryActionResult <T>(entity, status));
 }
示例#6
0
 public object ActionResult(T entity, RepositoryActionStatus status, Exception exception)
 {
     return(new RepositoryActionResult <T>(entity, status, exception));
 }
示例#7
0
 public IRepositoryActionResult GetRepositoryActionResult(object result = null, RepositoryActionStatus status = RepositoryActionStatus.BadRequest, Exception exception = null, string message = null)
 {
     return(new RepositoryActionResult(result: result, status: status, exception: exception, message: message));
 }
 public RepositoryActionResult(RepositoryActionStatus status, T entity, Exception exception) : this(status, entity, "")
 {
     Exception = exception;
 }
 public RepositoryActionResult(RepositoryActionStatus status, T entity, string message = "")
 {
     Status  = status;
     Entity  = entity;
     Message = message;
 }
示例#10
0
 public RepositoryActionResult(T model, RepositoryActionStatus status, Exception exception) : this(model, status)
 {
     Exception = exception;
 }
示例#11
0
 public RepositoryActionResult(T model, RepositoryActionStatus status)
 {
     Model  = model;
     Status = status;
 }