public async Task <IActionResult> AddSize([FromBody] SizeViewModel sizeVm)
        {
            var hasPermission = await _authorizationService.AuthorizeAsync(User, "SIZE", Operations.Create);

            if (hasPermission.Succeeded == false)
            {
                return(new BadRequestObjectResult(CommonConstants.Forbidden));
            }
            if (ModelState.IsValid)
            {
                _productQuantityService.AddSize(sizeVm);
                _productQuantityService.SaveChanges();
                return(new OkObjectResult(sizeVm.Id));
            }
            return(new BadRequestObjectResult(ModelState));
        }
 public HttpResponseMessage CreateSize(HttpRequestMessage request, SizeViewModel sizeVm)
 {
     if (ModelState.IsValid)
     {
         var model = new Size();
         try
         {
             model.UpdateSize(sizeVm);
             _productQuantityService.AddSize(model);
             _productQuantityService.Save();
             return(request.CreateResponse(HttpStatusCode.OK, sizeVm));
         }
         catch (Exception dex)
         {
             return(request.CreateErrorResponse(HttpStatusCode.BadRequest, dex.Message));
         }
     }
     else
     {
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }