Beispiel #1
0
 public ActionResult <KanbanContainer> Post([FromBody] KanbanContainer container)
 {
     if (_service.Create(container))
     {
         return(CreatedAtAction(nameof(GetContainer), new { id = container.Id }, container));
     }
     else
     {
         return(BadRequest());
     }
 }
        public async Task <IActionResult> Create([FromBody] CreateContainerCommand command)
        {
            var newValue = await _containerService.Create(command);

            _auditTrailService.LogAction(AuditTrailAction.CreateContainer, newValue.Id, new AuditTrailPayloadModel()
            {
                Data = JsonConvert.SerializeObject(command)
            });
            if (command.ParentRootId.HasValue)
            {
                _relationshipService.Create(new CreateRelationshipCommand()
                {
                    FromType = ObjectType.Container, ToType = ObjectType.Container, FromId = command.ParentRootId.Value, ToId = newValue.RootId, Branch = command.Branch
                });
            }

            return(Ok(newValue));
        }
        public Container Create(CreateContainerCommand command)
        {
            var newValue = _containerService.Create(command).Result;

            _auditTrailService.LogAction(AuditTrailAction.CreateContainer, newValue.Id, new AuditTrailPayloadModel()
            {
                Data = JsonConvert.SerializeObject(command)
            });
            if (command.ParentRootId.HasValue)
            {
                _relationshipService.Create(new CreateRelationshipCommand()
                {
                    FromType = ObjectType.Container, ToType = ObjectType.Container, FromId = command.ParentRootId.Value, ToId = newValue.RootId, Branch = command.Branch, CreateByUserId = command.CreateByUserId
                });
            }

            return(newValue);
        }