ant-design-blazor/components/upload/UploadFileItem.cs
James Yeung ddb09a9aa8 fix(module: upload): style of file list and picture card (#1001)
* fix(module: upload): file list style

* refactor upload button to fix ref conflict
2021-01-19 21:18:50 +08:00

38 lines
954 B
C#

using System.Linq;
using System.Text.Json;
namespace AntDesign
{
public class UploadFileItem
{
public string Id { get; set; }
public string FileName { get; set; }
public int Percent { get; set; }
public string ObjectURL { get; set; }
public string Url { get; set; }
public string Response { get; set; }
public UploadState State { get; set; }
public long Size { get; set; }
public string Ext { get; set; }
public string Type { get; set; }
public TResponseModel GetResponse<TResponseModel>(JsonSerializerOptions options = null) => JsonSerializer.Deserialize<TResponseModel>(this.Response, options);
public bool IsPicture()
{
string[] imageTypes = new[] { ".jpg", ".png", ".gif", ".ico" };
Ext = FileName.Substring(FileName.LastIndexOf('.'));
return imageTypes.Contains(Ext);
}
}
}