示例#1
0
        public List <Department> SelectAll()
        {
            try
            {
                // Execute the DAL code
                var result = _departmentDbContext.Get();


                // Some logs
                _loggerService.WriteLog($"SelectAll Department succeeded. Total: {result.Count}", LOG.Info);


                // Return the execution result
                return(result.Select(r => new Department()
                {
                    Id = r.DeptId,
                    Location = r.Location,
                    Name = r.Name
                }).ToList());
            }
            catch (Exception ex)
            {
                _loggerService.WriteLog($"SelectAll Department failed. Exception: {ex.Message}", LOG.Fatal);

                return(null);
            }
        }