private void Init(object data, bool success, JsonSerializerSettings serializerSettings) { result = new ApiResultJson { Result = data, Success = success, }; jsonResult = serializerSettings == null ? new JsonResult(result) : new JsonResult(result, serializerSettings); }
public static ApiResult Error(string content = "", string title = "") { Notification[] notifications = null; if (new[] { content, title }.Any(a => !string.IsNullOrEmpty(a))) { notifications = new[] { new Notification { Content = content, Title = title, Type = NotificationType.Error } }; } ApiResultJson result = new ApiResultJson { Success = false, Notifications = notifications, }; var jsonResult = new JsonResult(result); return(new ApiResult(jsonResult, result)); }
private ApiResult(JsonResult jsonResult, ApiResultJson result) { this.jsonResult = jsonResult; this.result = result; }