public IStatusCodeActionResult Get(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            EmployeeModel model = factoryService.Get(id);

            if (model == null)
            {
                return(NotFound());
            }

            return(new OkObjectResult(model));
        }
예제 #2
0
 /// <summary>
 /// Returns an object of the specified type.
 /// </summary>
 /// <typeparam name="T">The type of the object to be returned.</typeparam>
 /// <param name="factoryService">The factory service.</param>
 /// <returns>An instance of an object of type T.</returns>
 public static T Get <T>(this IFactoryService factoryService) where T : class => (T)factoryService.Get(typeof(T));