Files
myoffice/MyOffice.Web/Models/Item/ItemViewModel.cs
T
2023-12-16 21:18:01 +02:00

29 lines
647 B
C#

namespace MyOffice.Web.Models.Item;
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using MyOffice.Services.Account.Domain;
public class ItemViewModel : BaseViewModel
{
public string? Id { get; set; }
[Required]
public string? Name { get; set; }
public bool AllowDelete { get; set; }
public string CategoryId { get; set; } = null!;
public string? Category { get; set; } = null!;
public string? AccountId { get; set; }
}
public class ItemViewModelProfile: Profile
{
public ItemViewModelProfile()
{
CreateMap<ItemDto, ItemViewModel>()
.ForMember(x => x.Category, o => o.MapFrom(x => x.Category!.Name))
;
}
}