public HttpResponseMessage Delete(HttpRequestMessage request, int productId, int colorId, int sizeId)
        {
            _productQuantityService.Delete(productId, colorId, sizeId);
            _productQuantityService.Save();

            return(request.CreateResponse(HttpStatusCode.OK, "Xóa thành công"));
        }
        public async Task <IActionResult> Delete(int productId, int sizeId, int colorId)
        {
            var hasPermission = await _authorizationService.AuthorizeAsync(User, "PRODUCT", Operations.Delete);

            if (hasPermission.Succeeded == false)
            {
                return(new BadRequestObjectResult(CommonConstants.Forbidden));
            }
            _productQuantityService.Delete(productId, sizeId, colorId);
            _productQuantityService.SaveChanges();
            return(new OkObjectResult(productId));
        }
Esempio n. 3
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int productId, int colorId, int sizeId)
        {
            var newQuantity            = new ProductQuantity();
            var identity               = (ClaimsIdentity)User.Identity;
            IEnumerable <Claim> claims = identity.Claims;

            _productQuantityService.Delete(productId, colorId, sizeId);
            _productQuantityService.Save();
            Log log = new Log()
            {
                AppUserId = claims.FirstOrDefault().Value,
                Content   = Notification.DELETE_PRODUCTQUANTITY,
                Created   = DateTime.Now
            };

            _logService.Create(log);
            _logService.Save();
            return(request.CreateResponse(HttpStatusCode.OK, "Xóa thành công"));
        }