Ejemplo n.º 1
0
        public string Update(BrandDto brand)
        {
            if (!brand.IsValid())
            {
                return("Invalid Brand");
            }

            bool isUpdated = brandService.Update(brand);

            return(isUpdated ? "Brand updated successfully." : "Failed to update the Brand");
        }
Ejemplo n.º 2
0
        public string Create(BrandDto brand)
        {
            if (!brand.IsValid())
            {
                return("Invalid Brand");
            }

            bool isCreated = brandService.Create(brand);

            return(isCreated ? "Brand added successfully." : "Failed to create the Brand.");
        }
        public IActionResult Create([FromBody] BrandDto brandDto)
        {
            if (!brandDto.IsValid())
            {
                return(BadRequest());
            }

            if (brandService.Create(brandDto))
            {
                return(NoContent());
            }

            return(BadRequest());
        }
        public IActionResult Update([FromRoute] int id, [FromBody] BrandDto brandDto)
        {
            if (!brandDto.IsValid())
            {
                return(BadRequest());
            }
            brandDto.Id = id;

            if (brandService.Update(brandDto))
            {
                return(NoContent());
            }

            return(BadRequest());
        }