Ejemplo n.º 1
0
        public async Task <IActionResult> CreateColour(ColourCreationDto dto)
        {
            var newColour = new ColourCreationDto
            {
                Name      = dto.Name,
                ProductId = dto.ProductId
            };

            await _colourRepository.Create(newColour);

            return(Ok(dto));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DeleteColour(ColourCreationDto dto)
        {
            try
            {
                await _colourRepository.Delete(dto);

                return(Ok());
            }
            catch (Exception e)
            {
                return(NotFound("This Colour cannot be delete"));
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> UpdateColour(ColourCreationDto dto)
        {
            try
            {
                var update = new ColourCreationDto
                {
                    Name      = dto.Name,
                    ProductId = dto.ProductId
                };

                await _colourRepository.Update(dto);

                return(Ok(update));
            }
            catch (Exception e)
            {
                return(NotFound("This Colour cannot be changed"));
            }
        }