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