Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Price")] StoreItem storeItem)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            bool createResult = await _adminStoreBL.CreateStoreItem(storeItem);

            return(Redirect(nameof(Index)));
        }
        public async Task <IActionResult> Create([FromBody] StoreItem storeItem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bool result = await _adminStoreBL.CreateStoreItem(storeItem);

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

            return(Ok(new EmptyResult()));
        }