Exemplo n.º 1
0
        public async Task <OutToolDTO> CreateToolAsync(InToolDTO inToolDto)
        {
            var tool = await _toolRepository.Create(new Tool()
            {
                Name = inToolDto.Tool
            });

            var outToolDto = new OutToolDTO()
            {
                Tool = tool.Name
            };

            return(outToolDto);
        }
Exemplo n.º 2
0
        public Tool CreateTool(ToolForCreationDto toolForCreation)
        {
            //***Validate input;
            //TODO

            //map the creation dto to regular tool
            Tool tool = new Tool()
            {
                Name              = toolForCreation.Name,
                Description       = toolForCreation.Description,
                DailyCost         = toolForCreation.DailyCost,
                ReplacementCost   = toolForCreation.ReplacementCost,
                QuantityAvailable = toolForCreation.QuantityAvailable
            };
            Tool createdTool = _toolRepository.Create(tool);

            return(createdTool);
        }