using StudentPerformanceContracts.BindingModels; using StudentPerformanceContracts.ViewModels; using StudentPerformanceDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StudentPerformanceDatabaseImplement.Models { public class Formats : IFormatModel { public int Id { get; private set; } [Required] public string Name { get; private set; } = string.Empty; public static Formats? Create(FormatBindingModel? model) { if (model == null) { return null; } return new Formats() { Id = model.Id, Name = model.Name, }; } public static Formats? Create(FormatViewModel? model) { return new Formats() { Id = model.Id, Name = model.Name, }; } public void Update(FormatBindingModel? model) { if (model == null) { return; } Name = model.Name; } public FormatViewModel GetViewModel => new() { Id = Id, Name = Name, }; } }