Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        public void UpdateMapping(MappingModel model)
        {
            var template = TemplateService.GetSingleTemplate(model.GcTemplate.Id);
            var project  = ProjectsService.GetSingleProject(template.Data.ProjectId.ToString());

            var templateMapping = new TemplateMapping
            {
                MappingId         = model.MappingId,
                MappingTitle      = model.MappingTitle,
                DefaultLocationId = model.DefaultLocationId,
                LastUpdatedDate   = template.Data.Updated.ToString(),
                GcProjectId       = project.Data.Id.ToString(),
                GcProjectName     = project.Data.Name,
                CmsTemplate       = new CmsTemplate
                {
                    TemplateId = model.CmsTemplate.Id
                },
                GcTemplate = new GcTemplate
                {
                    GcTemplateId   = template.Data.Id.ToString(),
                    GcTemplateName = template.Data.Name
                },
            };

            var fieldMappings = ConvertToFieldMappings(model.FieldMappings);

            templateMapping.FieldMappings = fieldMappings;
            MappingRepository.UpdateMapping(templateMapping);
        }