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