using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; namespace EnVisage.Models { public class UserQuickLinkModel : IBaseModel { 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; } /// /// Casts a obect to the object of type . /// /// A object. /// A object filled with data from db. 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; } /// /// Copies data from model to DAL object. /// /// A target DAL object. 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; } } }