コード例 #1
0
ファイル: EmployeeService.cs プロジェクト: mlkj/20151202YL
 /// <summary>
 /// 创建实体
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 protected virtual async Task CreateEmployeeAsync(CreateOrUpdateEmployeeInput input)
 {
     var employee = input.Employee.MapTo<BaseEmployeeInfo>();
     employee.CreatorUserId = YLSession.UserId;
     employee.CreatorUserName = "";
     employee.CreationTime = Clock.Now;
     await _employeeRepository.InsertAsync(employee);
     cacheHandler.Remove(CacheCategoryEmployee, "GetEmployeeList");
 }
コード例 #2
0
ファイル: EmployeeService.cs プロジェクト: mlkj/20151202YL
        /// <summary>
        /// 修改实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        protected virtual async Task UpdateEmployeeAsync(CreateOrUpdateEmployeeInput input)
        {
            Debug.Assert(input.Employee.Id != null, "input.Employee.Id should be set.");

            var employee = await _employeeRepository.GetAsync(input.Employee.Id);
            employee = input.Employee.MapTo<BaseEmployeeInfo>();
            employee.LastModifierUserId = YLSession.UserId;
            employee.LastModifierUserName = "";
            employee.LastModificationTime = Clock.Now;
            await _employeeRepository.UpdateAsync(employee);
            cacheHandler.Remove(CacheCategoryEmployee, "GetEmployeeList");
        }
コード例 #3
0
ファイル: EmployeeService.cs プロジェクト: mlkj/20151202YL
 /// <summary>
 /// 添加修改实体
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task CreateOrUpdateEmployee(CreateOrUpdateEmployeeInput input)
 {
     if (input.Employee.Id != null && input.Employee.Id != Guid.Empty)
     {
         await UpdateEmployeeAsync(input);
     }
     else
     {
         await CreateEmployeeAsync(input);
     }
 }