Example #1
0
        public virtual async Task DeleteBrand(Brand brand)
        {
            await _brandService.DeleteBrand(brand);

            //activity log
            await _customerActivityService.InsertActivity("DeleteBrand", brand.Id, _translationService.GetResource("ActivityLog.DeleteBrand"), brand.Name);
        }
Example #2
0
 public JsonResult Delete(int id)
 {
     _iBrandService.DeleteBrand(id);
     return(Json(new Result()
     {
         success = true, msg = "删除成功!"
     }));
 }
        public async Task <IActionResult> DeleteBrand(int id)
        {
            var brand = await _brandService.GetBrandById(id);

            await _brandService.DeleteBrand(brand);

            return(NoContent());
        }
        public ActionResult <DeleteBrandResponse> DeleteBrand(long id)
        {
            var request = new DeleteBrandRequest {
                Id = id
            };
            var response = _service.DeleteBrand(request);

            return(response);
        }
Example #5
0
        public ActionResult <DeleteBrandResponse> DeleteBrnad(long id)
        {
            var deleteBrandRequest = new DeleteBrandRequest
            {
                Id = id
            };
            var deletBrandResponse = _brandService.DeleteBrand(deleteBrandRequest);

            return(deletBrandResponse);
        }
        public async Task <IActionResult> DeleteBrand(int idBrand)
        {
            ServiceResponse <List <Brand> > response = await _brandService.DeleteBrand(idBrand);

            if (response.Data == null)
            {
                return(NotFound(response));
            }
            return(Ok(response));
        }
Example #7
0
        public IActionResult Delete(int id)
        {
            var brand = brandService.GetBrand(id);

            brandService.DeleteBrand(brand);

            var brands = brandService.GetAll();

            return(Json(new { html = Helper.RenderRazorViewToString(this, "_ViewAll", brands) }));
        }
        public IActionResult Deleted(Brand brand)
        {
            var result = _brandService.DeleteBrand(brand);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Example #9
0
        public async Task <IActionResult> Delete(string IdBrand)
        {
            var affectedResult = await _brandService.DeleteBrand(IdBrand);

            if (affectedResult == 0)
            {
                return(BadRequest());
            }
            return(Ok());
        }
Example #10
0
        public ActionResult RemoveBrand(int id)
        {
            BrandDTO brand = new BrandDTO {
                Id = id
            };

            brandService.DeleteBrand(brand);

            return(RedirectToAction("Index"));
        }
Example #11
0
        public async Task <IActionResult> DeleteBrand(Guid brandId)
        {
            bool result = await brandService.DeleteBrand(brandId);

            if (!result)
            {
                return(InvalidRequest());
            }

            return(NoContent());
        }
 public ActionResult <Brand> Delete(int id)
 {
     try
     {
         return(Ok(_brandService.DeleteBrand(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public async Task <IActionResult> Delete(int id)
        {
            BrandDto brandDto = await _brandService.GetBrand(id);

            if (brandDto == null)
            {
                return(NotFound("No such brand"));
            }
            await _brandService.DeleteBrand(id);

            return(Ok());
        }
        public async Task <bool> Handle(DeleteBrandCommand request, CancellationToken cancellationToken)
        {
            var brand = await _brandService.GetBrandById(request.Model.Id);

            if (brand != null)
            {
                await _brandService.DeleteBrand(brand);

                //activity log
                await _customerActivityService.InsertActivity("DeleteBrand", brand.Id, _translationService.GetResource("ActivityLog.DeleteBrand"), brand.Name);
            }
            return(true);
        }
        public async Task <IHttpActionResult> Delete(Guid id)
        {
            var brand = await _brandService.GetBrand(id).ConfigureAwait(false);

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

            await _brandService.DeleteBrand(id).ConfigureAwait(false);

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IActionResult> DeleteBrand(Guid id)
        {
            try
            {
                await _brandService.DeleteBrand(id);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #17
0
        public ActionResult Delete(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog))
            {
                return(AccessDeniedView());
            }

            var brand = _brandService.GetBrandById(id);

            if (brand == null)
            {
                //No product attribute found with the specified id
                return(RedirectToAction("List"));
            }

            _brandService.DeleteBrand(brand);

            //activity log
            _customerActivityService.InsertActivity("DeleteBrand", _localizationService.GetResource("ActivityLog.DeleteBrand"), brand.Name);

            SuccessNotification(_localizationService.GetResource("Admin.Brand.Deleted"));
            return(RedirectToAction("List"));
        }
Example #18
0
        public ActionResult Delete(int brandId)
        {
            if (brandId <= 0)
            {
                throw new Exception("brand");
            }

            using (var unitOfWork = _unitOfWorkManager.Begin())
            {
                _brandService.DeleteBrand(brandId);

                unitOfWork.Complete();
                return(Json("ok"));
            }
        }
        public ActionResult Delete(int brandId)
        {
            DeleteBrandRequest  request  = new DeleteBrandRequest();
            DeleteBrandResponse response = new DeleteBrandResponse();

            request.BrandId = brandId;
            response        = brandService.DeleteBrand(request);
            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                BrandListPageViewModel model = new BrandListPageViewModel();
                model.Success      = false;
                model.ErrorMessage = response.Message;
                return(View("Index", model));
            }
        }
 public ActionResult <Brand> DeleteByID(int id)
 {
     try
     {
         Brand brand = BrandService.DeleteBrand(id);
         return((brand != null) ? Accepted(brand) : StatusCode(500, $"Server error deleting brand with Id: {id}"));
     }
     catch (ArgumentException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (InvalidDataException ex)
     {
         return(NotFound(ex.Message));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, $"Server error deleting brand with Id: {id}"));
     }
 }
        public IActionResult DeleteBrand(int id)
        {
            try
            {
                Brand brand = _brandService.GetBrandById(id);
                if (brand.IsEntityNull())
                {
                    _logger.Error($"Brand with id: {id} not found in db");
                    return(NotFound());
                }

                _brandService.DeleteBrand(brand);
                _brandService.Save();

                return(NoContent());
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Error in call : api/brand/DeleteBrand/" + id);
                return(StatusCode(StatusCodes.Status500InternalServerError, "Internal server error"));
            }
        }
Example #22
0
 public async Task <IActionResult> DeleteBrand(int id)
 {
     return(await Do(async() => await _brandService.DeleteBrand(id)));
 }
Example #23
0
        public async Task <ActionResult <BrandVm> > DeleteBrand(int id)
        {
            await _brandService.DeleteBrand(id);

            return(NoContent());
        }
 public IActionResult DeleteVC(int id)
 {
     _service.DeleteBrand(id);
     return(RedirectToAction("Index"));
 }
Example #25
0
 public ActionResult Delete(int Id)
 {
     service.DeleteBrand(Id);
     return(RedirectToAction("Index"));
 }
Example #26
0
 public async Task <string> DeleteBrand(int id)
 {
     return(await _brandService.DeleteBrand(id));
 }
Example #27
0
 /// <summary>
 /// 删除一个品牌
 /// </summary>
 /// <param name="id"></param>
 public static void DeleteBrand(long id)
 {
     _brandService.DeleteBrand(id);
 }