public void SaveForm(string keyValue, UserRoleEntity userRoleEntity) { if (!string.IsNullOrEmpty(keyValue)) { Base_UserRole role = Base_UserRole.SingleOrDefault("where UserRoleId=@0", keyValue); role = EntityConvertTools.CopyToModel <UserRoleEntity, Base_UserRole>(userRoleEntity, role); role.UserRoleId = keyValue; role.Update(); } else { Base_UserRole role = EntityConvertTools.CopyToModel <UserRoleEntity, Base_UserRole>(userRoleEntity, null); role.Insert(); } }
public UserRoleEntity GetEntity(string keyValue) { var role = Base_UserRole.SingleOrDefault("where UserRoleId=@0", keyValue); return(EntityConvertTools.CopyToModel <Base_UserRole, UserRoleEntity>(role, null)); }