public async Task <ActionResult <Adult> > UpdateAdult([FromBody] Adult adult)
        {
            try {
                Adult updatedAdult = await adultsService.UpdateAdultAsync(adult);

                return(Ok(updatedAdult));
            }
            catch (Exception e) {
                Console.WriteLine(e);
                return(StatusCode(500, e.Message));
            }
        }
        public async Task <ActionResult <Adult> > UpdateAdult([FromBody] Adult adult, [FromRoute] string address)
        {
            try
            {
                Adult toUpdate = await adultService.UpdateAdultAsync(adult, address);

                return(Created($"/{toUpdate}", toUpdate));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
Exemple #3
0
        public async Task <ActionResult <Adult> > UpdateAdultAsync([FromBody] Adult adult)
        {
            try
            {
                Adult adultToUpdate = await _adultService.UpdateAdultAsync(adult);

                return(Ok(adultToUpdate));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(StatusCode(500, e.Message));
            }
        }
Exemple #4
0
        public async Task <ActionResult> EditAdult([FromRoute] int Id, [FromBody] Adult adult)
        {
            try
            {
                Console.WriteLine(adult);
                await _adultService.UpdateAdultAsync(Id, adult);

                return(Ok());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(StatusCode(500, e.Message));
            }
        }