/// <summary> /// Convert SubscriptionTypeAttribute Entity into SubscriptionTypeAttribute Object /// </summary> ///<param name="model">SubscriptionTypeAttributeViewModel</param> ///<param name="SubscriptionTypeAttributeEntity">DataAccess.SubscriptionTypeAttribute</param> ///<returns>SubscriptionTypeAttributeViewModel</returns> public static SubscriptionTypeAttributeViewModel ToViewModel( this DataAccess.SubscriptionTypeAttribute entity, SubscriptionTypeAttributeViewModel model) { model.SessionUserId = entity.CreatedUserId; model.Id = entity.Id; model.SubscriptionTypeId = entity.SubscriptionTypeId; model.SubscriptionType = entity.SubscriptionType.Name; model.Name = entity.Name; return(model); }
/// <summary> /// Convert SubscriptionTypeAttribute Object into SubscriptionTypeAttribute Entity /// </summary> ///<param name="model">SubscriptionTypeAttribute</param> ///<param name="SubscriptionTypeAttributeEntity">DataAccess.SubscriptionTypeAttribute</param> ///<returns>DataAccess.SubscriptionTypeAttribute</returns> public static DataAccess.SubscriptionTypeAttribute ToEntity(this SubscriptionTypeAttributeViewModel model, DataAccess.SubscriptionTypeAttribute entity) { if (entity.Id == 0) { entity.CreatedUserId = model.SessionUserId; } else { entity.UpdatedUserId = model.SessionUserId; entity.UpdatedTimestamp = DateTime.Now; } entity.SubscriptionTypeId = model.SubscriptionTypeId; entity.Name = model.Name; return(entity); }