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); }
public async Task <FederationModel> Put(string id, [FromBody] CreateFederation value) { var command = new UpdateFederation { Id = id, Name = value.Name, }; return(await _service.Update(command)); }
public async Task <ActionResult> Post(CreateFederation command) { await _dispatcher.SendAsync(command.BindId(c => c.Id)); return(Accepted()); }
public async Task <IActionResult> Post(CreateFederation command) => await SendAsync(command.BindId(c => c.Id), resourceId : command.Id, resource : "federations");
public async Task <FederationModel> Post([FromBody] CreateFederation value) { return(await _service.Add(value)); }