PIbd-21_MasenkinMS_Coursewo.../Hospital/HospitalContracts/ViewModels/MedicineViewModel.cs

62 lines
1.6 KiB
C#
Raw Normal View History

2024-04-16 02:44:22 +04:00
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
/// <summary>
/// Модель представления для сущности "Лекарство"
/// </summary>
public class MedicineViewModel : IMedicineModel
{
/// <summary>
/// Идентификатор
/// </summary>
public int Id { get; set; }
/// <summary>
/// Название лекарства
/// </summary>
[DisplayName("Название лекарства")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// Описание лекарства
/// </summary>
[DisplayName("Описание лекарства")]
public string? Description { get; set; }
2024-05-27 22:25:54 +04:00
/// <summary>
/// Получить хэш-код
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return Id.GetHashCode();
}
/// <summary>
/// Сравнить объекты
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public override bool Equals(object? obj)
{
if (this == obj)
{
return true;
}
if (obj != null && obj is MedicineViewModel other)
{
return this.Id == other.Id;
}
return false;
}
2024-04-16 02:44:22 +04:00
}
}