Exemplo n.º 1
0
        public async Task <IActionResult> Delete([FromRoute] Int32 brandId)
        {
            var deleted = await _brandService.DeleteBrandAsync(brandId);

            if (deleted)
            {
                return(NoContent());
            }
            return(NotFound());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteBrand(string brandName)
        {
            var result = await _brandService.DeleteBrandAsync(brandName);

            if (!result)
            {
                return(NotFound(new Response <string>("The specified brand was not found.")));
            }

            return(Ok(new Response <string>("Brand deleted successfully.")));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Delete(int id)
        {
            var deleted = await _brandService.DeleteBrandAsync(id);

            if (deleted)
            {
                return(NoContent());
            }

            return(NotFound());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> DeleteBrandAsync([FromRoute] Guid id)
        {
            var obj = await _brandService.GetBrandByIdAsync(id);

            if (obj == null)
            {
                return(NotFound());
            }

            await _brandService.DeleteBrandAsync(id);

            return(NoContent());
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            if (await _brandService.DeleteBrandAsync(id.Value))
            {
                TempData["SuccessMessage"] = _localizer.GetLocalizedString("msg_DeleteBrandSuccess").ToString();
                return(RedirectToAction(nameof(Index)));
            }
            TempData["ErrorMessage"] = _localizer.GetLocalizedString("err_DeleteBrand").ToString();
            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> DeleteBrand(int id)
        {
            var brand = await _brandService.GetBrandByIdAsync(id);

            if (brand == null)
            {
                return(BadRequest("Brand not found"));
            }

            await _brandService.DeleteBrandAsync(brand);

            return(Ok(new
            {
                status = 200,
                message = "Brand deleted successfully!"
            }));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Delete(string id)
        {
            string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            var getOld = await _brandService.GetBrandById(id, userId);

            if (getOld == null)
            {
                return(NotFound());
            }

            var deletedBrand = await _brandService.DeleteBrandAsync(id, userId);

            return(Ok(new OperationResponse <Brand>
            {
                IsSuccess = true,
                Message = $"{getOld.Name} has been deleted successfully!",
                Record = deletedBrand
            }));
        }
 protected override async Task PerformDeleteAsync(int entityId)
 {
     await _brandService.DeleteBrandAsync(entityId);
 }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            await service.DeleteBrandAsync(id);

            return(RedirectToAction(nameof(Index)));
        }