PhoneToolMX/PhoneToolMX.Models/Models/OwnedBase.cs
2023-10-17 21:55:10 -07:00

18 lines
449 B
C#

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));
}
}
}