Esempio n. 1
0
        public async Task <IHttpActionResult> PostAsync(EmployeeRecord employee)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await _employeeProvider.CreateAsync(employee);

                    return(Created($"{Request.RequestUri}/{employee.Id}", employee));
                }

                return(BadRequest(ModelState));
            }
            catch (Exception e)
            {
                _logger.LogError("Error when posting employee", e);
                return(InternalServerError(e));
            }
        }