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