Exemplo n.º 1
0
        /// <summary>
        /// Converts from the FoundOPS model to the API model
        /// </summary>
        /// <param name="fieldModel">The FoundOPS model of a LocationField to be converted</param>
        /// <returns>A LocationField that has been converted to it's API model</returns>
        public static LocationField ConvertModel(Core.Models.CoreEntities.LocationField fieldModel)
        {
            var field = new LocationField
                {
                    Id = fieldModel.Id,
                    CreatedDate = fieldModel.CreatedDate,
                    Name = fieldModel.Name,
                    Required = fieldModel.Required,
                    ToolTip = fieldModel.Tooltip,
                    ParentFieldId = fieldModel.ParentFieldId,
                    ServiceTemplateId = fieldModel.ServiceTemplateId,
                    LocationId = fieldModel.LocationId,
                    LocationFieldTypeInt = fieldModel.LocationFieldTypeInt,
                    Value = fieldModel.Value != null ? Location.ConvertModel(fieldModel.Value) : null
                };

            field.SetLastModified(fieldModel.LastModified, fieldModel.LastModifyingUserId);

            return field;
        }