/// <summary> /// 添加登录日志 /// </summary> /// <param name="logDto"></param> /// <returns></returns> public Task <int> AddLoginLogAsync(LoginLogDto logDto) { var logEntity = logDto.MapTo <LoginLogEntity>(); baseService.Add(logEntity); Task <int> result = baseService.SaveAsync(); return(result); }
/// <summary> /// 编辑loginlog /// </summary> /// <param name="dto">实体</param> /// <returns></returns> public bool Update(LoginLogDto dto) { using (var scope = _dbScopeFactory.Create()) { var db = GetDb(scope); var dbSet = GetDbSet(db); //var entity = Mapper.Map<LoginLogDto, LoginLogEntity>(dto); var entity = dto.MapTo <LoginLogEntity>(); dbSet.AddOrUpdate(entity); return(db.SaveChanges() > 0); } }