Esempio n. 1
0
        public async Task <IActionResult> UpdateEmployee([FromBody] Employee model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string message = await serviceapi.UpdateEmployee(model);

                    return(Ok(message));
                }
                catch (Exception ex)
                {
                    if (ex.GetType().FullName ==
                        "Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException")
                    {
                        return(NotFound());
                    }

                    return(BadRequest());
                }
            }

            return(BadRequest());
        }