Esempio n. 1
0
        public async Task <IActionResult> UpdateEmployee([FromBody] EmployeeViewModel model, int id)
        {
            try
            {
                if (model.Name == null)
                {
                    return(BadRequest());
                }

                model.Id = id;
                await _employeeProvider.EditEmployeeAsync(ViewToData.ConvertEmployee(model));

                return(Ok());
            }
            catch (ArgumentException)
            {
                return(StatusCode(403));
            }
            catch (OperationCanceledException)
            {
                return(StatusCode(403));
            }
            catch (Exception)
            {
                return(StatusCode(500));
            }
        }