Beispiel #1
0
        public async Task <IActionResult> CreateEmployee([FromBody] EmployeeViewModel model)
        {
            try
            {
                if (model == null)
                {
                    return(BadRequest());
                }

                await _employeeProvider.CreateEmployeeAsync(ViewToData.ConvertEmployee(model));

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