roadie/Roadie.Api.Library/FileOperationResult.cs

51 lines
1.5 KiB
C#
Raw Normal View History

2018-11-11 01:11:58 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Net.Http.Headers;
namespace Roadie.Library
{
/// <summary>
/// A OperationResult specific to a File type request.
/// </summary>
public class FileOperationResult<T> : OperationResult<T>
{
public EntityTagHeaderValue ETag { get; set; }
public DateTimeOffset? LastModified { get; set; }
public string ContentType { get; set; }
2018-11-11 14:46:09 +00:00
public FileOperationResult()
{
}
2018-11-11 01:11:58 +00:00
public FileOperationResult(string message)
{
this.AddMessage(message);
}
2018-11-11 16:20:33 +00:00
public FileOperationResult(bool isNotFoundResult, string message)
{
this.IsNotFoundResult = isNotFoundResult;
this.AddMessage(message);
}
2018-11-11 01:11:58 +00:00
public FileOperationResult(IEnumerable<string> messages = null)
{
if (messages != null && messages.Any())
{
this.AdditionalData = new Dictionary<string, object>();
messages.ToList().ForEach(x => this.AddMessage(x));
}
}
2018-11-11 16:20:33 +00:00
public FileOperationResult(bool isNotFoundResult, IEnumerable<string> messages = null)
{
this.IsNotFoundResult = isNotFoundResult;
2018-11-11 20:45:44 +00:00
if (messages != null && messages.Any())
{
this.AdditionalData = new Dictionary<string, object>();
messages.ToList().ForEach(x => this.AddMessage(x));
}
2018-11-11 16:20:33 +00:00
}
2018-11-11 01:11:58 +00:00
}
}