74 lines
1.9 KiB
C#
74 lines
1.9 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace EnVisage.Models
|
|
{
|
|
public class CreditDepartmentModel : IBaseModel<CreditDepartment>
|
|
{
|
|
public Guid Id { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
[Display(Name = "Department")]
|
|
public string Name { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(50)]
|
|
[Display(Name = "Cost Center")]
|
|
public string CreditNumber { get; set; }
|
|
|
|
[Display(Name = "Number of Expenditures")]
|
|
public int ExpenditureCategoryCount { get; set; }
|
|
|
|
/// <summary>
|
|
/// Copies data from model to DAL object.
|
|
/// </summary>
|
|
/// <param name="dbObj">A target DAL object.</param>
|
|
public void CopyTo(CreditDepartment dbObj)
|
|
{
|
|
if (dbObj == null)
|
|
throw new ArgumentNullException();
|
|
|
|
dbObj.Name = Name;
|
|
dbObj.CreditNumber = CreditNumber;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// An UI representation of CreditDepartment to be displayed as list items
|
|
/// </summary>
|
|
public class CreditDepartmentListModel
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Name { get; set; }
|
|
public string CreditNumber { get; set; }
|
|
public int ExpenditureCount { get; set; }
|
|
}
|
|
|
|
public class CreditDepartmentApiModel
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Name { get; set; }
|
|
public string CreditNumber { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public CreditDepartmentApiModel()
|
|
{
|
|
|
|
}
|
|
|
|
public CreditDepartmentApiModel(CreditDepartmentModel model)
|
|
: this()
|
|
{
|
|
if (model == null)
|
|
throw new ArgumentNullException("model");
|
|
|
|
Id = model.Id;
|
|
Name = model.Name;
|
|
CreditNumber = model.CreditNumber;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |