EnVisageOnline/Main-RMO/Source/EnVisage/Models/UserQuickLinkModel.cs

58 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace EnVisage.Models
{
public class UserQuickLinkModel : IBaseModel<UserQuickLink>
{
public Guid Id { get; set; }
[Required]
[Display(Name = "Title")]
public string Name { get; set; }
public System.Guid UserId { get; set; }
public string Url { get; set; }
public string PageState { get; set; }
/// <summary>
/// Casts a <see cref="Rate"/> obect to the object of type <see cref="RateModel"/>.
/// </summary>
/// <param name="obj">A <see cref="Rate"/> object.</param>
/// <returns>A <see cref="RateModel"/> object filled with data from db.</returns>
public static explicit operator UserQuickLinkModel(UserQuickLink obj)
{
if (obj == null)
return null;
var model = new UserQuickLinkModel
{
Id = obj.Id,
Name = obj.Name,
UserId = obj.UserId,
Url = obj.Url,
PageState = obj.PageState
};
return model;
}
/// <summary>
/// Copies data from model to DAL object.
/// </summary>
/// <param name="dbObj">A target DAL object.</param>
public void CopyTo(UserQuickLink dbObj)
{
if (dbObj == null)
throw new ArgumentNullException();
dbObj.Id = Id;
dbObj.Name = Name;
dbObj.UserId = UserId;
dbObj.Url = Url;
dbObj.PageState = PageState;
}
}
}