flower-story/Server/Controller/FlowerApiController.structs.cs
2023-06-26 22:33:44 +08:00

63 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
namespace Blahblah.FlowerStory.Server.Controller;
/// <summary>
/// 花草参数
/// </summary>
public record FlowerParameter
{
/// <summary>
/// 类别 id
/// </summary>
[Required]
[FromForm(Name = "categoryId")]
public int CategoryId { get; init; }
/// <summary>
/// 花草名称
/// </summary>
[Required]
[FromForm(Name = "name")]
public required string Name { get; init; }
/// <summary>
/// 购买时间
/// </summary>
[Required]
[FromForm(Name = "dateBuy")]
public long DateBuy { get; init; }
/// <summary>
/// 购买花费
/// </summary>
[FromForm(Name = "cost")]
public decimal? Cost { get; init; }
/// <summary>
/// 购买渠道
/// </summary>
[FromForm(Name = "purchase")]
public string? Purchase { get; init; }
/// <summary>
/// 花草封面
/// </summary>
[FromForm(Name = "cover")]
public IFormFile? Cover { get; init; }
}
/// <summary>
/// 花草修改参数
/// </summary>
public record FlowerUpdateParameter : FlowerParameter
{
/// <summary>
/// 花草唯一 id
/// </summary>
[Required]
[FromForm(Name = "id")]
public int Id { get; set; }
}