public async Task <FederationModel> Add(CreateFederation command)
        {
            command.Validate();

            if (command.Invalid)
            {
                _notificationContext.AddNotifications(command);
                return(null);
            }


            var federation = new Federation(command.Name);

            if (federation.Invalid)
            {
                _notificationContext.AddNotifications(federation);
                return(null);
            }

            var model = new FederationModel
            {
                Id   = federation.Id.ToString(),
                Name = federation.Name,
            };

            await _federationRepository.Add(model);

            return(model);
        }
Beispiel #2
0
        public async Task <FederationModel> Put(string id, [FromBody] CreateFederation value)
        {
            var command = new UpdateFederation
            {
                Id   = id,
                Name = value.Name,
            };

            return(await _service.Update(command));
        }
Beispiel #3
0
        public async Task <ActionResult> Post(CreateFederation command)
        {
            await _dispatcher.SendAsync(command.BindId(c => c.Id));

            return(Accepted());
        }
Beispiel #4
0
 public async Task <IActionResult> Post(CreateFederation command)
 => await SendAsync(command.BindId(c => c.Id), resourceId : command.Id,
                    resource : "federations");
Beispiel #5
0
 public async Task <FederationModel> Post([FromBody] CreateFederation value)
 {
     return(await _service.Add(value));
 }