public async Task <IActionResult> Put([FromBody] FruitDto fruitDto)
        {
            try
            {
                if (fruitDto == null)
                {
                    return(this.BadRequestEx("fruitDto"));
                }

                //var fruit = _fruitService.FruitQuery(name);
                //if (fruit == null)
                //{
                //    return this.NotFoundEx();
                //}

                await _fruitService.FruitUpdate(fruitDto);

                return(this.NoContentEx());
            }
            catch (Exception ex)
            {
                return(this.ErrorEx(ex.Message));
            }
        }
Example #2
0
        public IActionResult Put(string name, [FromBody] FruitDto fruitDto)
        {
            try
            {
                if (fruitDto == null)
                {
                    return(this.BadRequestEx("fruitDto"));
                }

                var fruit = _fruitService.FruitQuery(name);
                if (fruit == null)
                {
                    return(this.NotFoundEx());
                }

                _fruitService.FruitUpdate(fruitDto);
                return(this.NoContentEx());
            }
            catch (Exception ex)
            {
                return(this.ErrorEx(ex.Message));
            }
        }