EnVisageOnline/Main-RMO/Source/EnVisage/Models/MixModels/MixTeamViewModel.cs

46 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Web.Mvc;
using MongoDB.Bson.Serialization.Attributes;
using EnVisage.Code.DAL.Mongo;
namespace EnVisage.Models
{
public class MixTeamViewModel
{
public string Id { get; set; }
public string TVName { get; set; }
public Guid? CompanyId { get; set; }
public Guid? CostCenterId { get; set; }
public Guid? CapacityTeamId { get; set; }
public bool CopyPlanned { get; set; }
public WidgetExpCategory[] Data { get; set; }
public bool IsNew { get; set; }
public Guid[] UserId { get; set; }
public SelectListGroup Group { get; set; }
/// <summary>
/// Converts an instance of <see cref="EnVisage.Code.DAL.Mongo.MixTeamView"/> entity to the new instance of <see cref="MixTeamViewModel"/> entity.
/// </summary>
/// <param name="entity">An object of <see cref="EnVisage.Code.DAL.Mongo.MixTeamView"/> type.</param>
/// <returns>An object of <see cref="MixTeamViewModel"/> prefilled with values from <paramref name="entity"/>.</returns>
public static explicit operator MixTeamViewModel(EnVisage.Code.DAL.Mongo.MixTeamView entity)
{
var model = new MixTeamViewModel
{
Id = entity.Id,
IsNew = entity.IsNew,
TVName = entity.Name,
Group = new SelectListGroup {Name = entity.Group, Disabled = false},
CompanyId = entity.CompanyId,
CostCenterId = entity.CostCenterId,
CapacityTeamId = entity.CapacityTeamId,
CopyPlanned = entity.CopyPlanned,
Data = entity.Data,
UserId = entity.UserId
};
return model;
}
}
}