PhoneToolMX/PhoneToolMX.Models/Models/OwnedBase.cs

18 lines
449 B
C#
Raw Normal View History

2023-10-18 04:55:10 +00:00
using Microsoft.EntityFrameworkCore.Metadata;
using PhoneToolMX.Models.ViewModels;
using System.ComponentModel.DataAnnotations;
namespace PhoneToolMX.Models
{
public class OwnedBase : IOwnedModel
{
public int? Id { get; set; }
public ICollection<User> Owners { get; set; }
public bool IsOwnedBy(User user)
{
return (Owners != null && Owners.Any(o => o.Id == user.Id));
}
}
}