/// <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); }
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()); }
public static DestinationTemplate ToEntity(this DestinationTemplateModel model, DestinationTemplate destination) { return(model.MapTo(destination)); }
public static DestinationTemplateModel ToModel(this DestinationTemplate entity) { return(entity.MapTo <DestinationTemplate, DestinationTemplateModel>()); }