public static AbstractEntities.NewPartner ToAbstract(this NewPartner web)
        {
            if (web == null)
            {
                return(null);
            }

            return(new AbstractEntities.NewPartner(web.Name, web.Address));
        }
        public IActionResult Create([FromBody] NewPartner newPartner)
        {
            if (newPartner == null)
            {
                throw new InvalidRequestArgumentException("The partner cannot be null or empty.");
            }
            if (string.IsNullOrWhiteSpace(newPartner.Name))
            {
                throw new InvalidRequestArgumentException("Partner name cannot be null or empty.");
            }

            var createdPartner = dataLayer.CreatePartner(newPartner.ToAbstract());

            return(CreatedAtAction("Get", new { id = createdPartner.Id }, createdPartner.ToWeb()));
        }
示例#3
0
        public NewPartnerDropIn(BaseForm baseForm, Partner partner, DropInClosed onDropInClosed)
            : base(baseForm, onDropInClosed)
        {
            InitializeComponent();

            if (partner != null)
            {
                btnSave.Text       = "Gem";
                lblNewPartner.Text = "Redigér partner";
            }

            newPartnerForm          = new NewPartner(baseForm, partner);
            newPartnerForm.Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            newPartnerForm.Location = new Point(10, 10);
            pnlContentHolder.Controls.Add(newPartnerForm);
        }
示例#4
0
        public static Partner CreatePartner(this PartnersController controller, NewPartner newPartner)
        {
            var actionResult = (CreatedAtActionResult)controller.Create(newPartner);

            return((Partner)actionResult.Value);
        }
示例#5
0
 public async void PublishNewPartner(NewPartner newPartner)
 {
     await _bus.PublishAsync(newPartner);
 }