コード例 #1
0
        /// <summary>
        /// Inserts destination template
        /// </summary>
        /// <param name="destinationTemplate">Destination template</param>
        public virtual void InsertDestinationTemplate(DestinationTemplate destinationTemplate)
        {
            if (destinationTemplate == null)
            {
                throw new ArgumentNullException("destinationTemplate");
            }

            _destinationTemplateRepository.Insert(destinationTemplate);

            //event notification
            _eventPublisher.EntityInserted(destinationTemplate);
        }
コード例 #2
0
        public virtual ActionResult DestinationTemplateAdd([Bind(Exclude = "Id")] DestinationTemplateModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            var template = new DestinationTemplate();

            template = model.ToEntity(template);
            _destinationTemplateService.InsertDestinationTemplate(template);

            return(new NullJsonResult());
        }
コード例 #3
0
 public static DestinationTemplate ToEntity(this DestinationTemplateModel model, DestinationTemplate destination)
 {
     return(model.MapTo(destination));
 }
コード例 #4
0
 public static DestinationTemplateModel ToModel(this DestinationTemplate entity)
 {
     return(entity.MapTo <DestinationTemplate, DestinationTemplateModel>());
 }