Ejemplo n.º 1
0
        public IActionResult Post([FromBody] ProductSizeDto productSizeDto)
        {
            var productSize           = _mapper.Map <ProductSize>(productSizeDto);
            var createdProductSize    = _productSizeService.Create(productSize);
            var createdProductSizeDto = _mapper.Map <ProductSizeDto>(createdProductSize);

            return(StatusCode((int)HttpStatusCode.Created, createdProductSizeDto));
        }
 public ActionResult <ProductSize> Post([FromBody] ProductSize value)
 {
     try
     {
         return(Ok(_productSizeService.Create(value)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 3
0
        public ActionResult Create(ProductSize vm)
        {
            if (ModelState.IsValid)
            {
                vm.CreatedDate  = DateTime.Now;
                vm.ModifiedDate = DateTime.Now;
                vm.CreatedBy    = User.Identity.Name;
                vm.ModifiedBy   = User.Identity.Name;
                vm.ObjectState  = Model.ObjectState.Added;
                _ProductSizeService.Create(vm);
                _unitOfWork.Save();
                return(RedirectToAction("Index").Success("Data saved successfully"));
            }


            return(View(vm));
        }