ASP.NET Core CS0535未实现接口

时间:2019-01-21 06:05:21

标签: c# service asp.net-core-2.1

对新手问题很抱歉,因为ASP.NET Core中有新功能。 我有指示CS0535的问题 CS0535 'UserInfoService'未实现接口成员'IUserInfoService.UpdateLogoutTime(string)' 社区服务 D:\ repo \ Community \ Community.Service \ Users \ UserInfoService.cs 23 有效

错误CS0535'UserInfoService'未实现接口成员'IUserInfoService.UpdateLoginTime(string)'Community.Service D:\ repo \ Community \ Community.Service \ Users \ UserInfoService.cs 23有效

public async Task UpdateLoginTimeAsync(string userId)
{
    var user = _dbIdentity.Users.Where(x => x.Id == userId).FirstOrDefault();
    user.LoginTime = DateTime.Now;
    _dbIdentity.Users.Update(user);
    await _dbIdentity.SaveChangesAsync();
}

public async Task UpdateLogOutTimeAsync(string userId)
{
    var user = _dbIdentity.Users.Where(x => x.Id == userId).FirstOrDefault();
    user.LogoutTime = DateTime.Now;
    _dbIdentity.Users.Update(user);
    await _dbIdentity.SaveChangesAsync();
}

using Community.Data.CommonDataTypes;
using Community.Data.Entities.Companies.ViewModels;
using Community.Data.Entities.Users;
using Community.Data.Entities.Users.ViewModels;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Community.Service.Users
{
    public interface IUserInfoService
    {
        CompanyRoleViewModel GetCompanyRole();

        Task<IEnumerable<CompanyRoleViewModel>> GetAllCompanyRolesAsync(long companyID);

        Task<CompanyRoleViewModel> GetCompanyRoleAsync(string companyRoleId);

        Task<ServiceSingleRecordInsertOrUpdateResponse> CreateCompanyRoleAsync(CompanyRoleViewModel model, long companyId);

        Task<ServiceSingleRecordInsertOrUpdateResponse> UpdateCompanyRoleAsync(CompanyRoleViewModel model);

        Task ApproveUserAccountsOfCompanyAsync(long companyId);

        Task<ServiceStatusResponse> DeleteUserAsync(string userId);

        Task<int> RetrieveNumberOfUsersAsync();

        Task<IEnumerable<UserInfo>> RetrieveAllUsersAsync(bool includingInactive = false);

        Task<string> GenerateCsvContentForAllUsersAsync(bool includingInactive = false);

        Task<UserInfo> RetrieveUserInfoAsync(string userId);

        Task<UserInfo> RetrieveUserInfoWithoutCompanyByPhoneNumberAsync(string phoneNumber);

        Task<UserInfo> RetrieveUserInfoByEmailAsync(string userEmail);

        Task<ServiceStatusResponse<UserInfo>> RetrieveUserInfoByPhoneNumberAsync(string phoneNumber);

        Task<string> RetrieveUserFullNameByEmailAsync(string userEmail);

        Task<CompanyProfileManageViewModel> RetrieveUserCompanyInfoByEmailAsync(string userEmail);

        Task<long> RetrieveCompanyIdByEmailAsync(string userEmail);

        Task<IEnumerable<UserInfo>> RetrieveInfoOfAllUsersInCompanyAsync(long companyId);

        Task<List<UserIdEmailViewModel>> RetrieveIdEmailOfAllUsersInCompanyAsync(long companyId);

        Task<List<UserIdEmailFullNameViewModel>> RetrieveIdEmailFullNameOfAllUsersAsync(bool includingInactive = false);

        Task<string[]> RetrieveEmailsOfAllUsersInCompanyAsync(long companyId);

        Task<IEnumerable<UserInfo>> RetrieveInfoOfAllSuperUsersAsync();

        Task<bool> SubmitNewUserAccountCreationRequest(NewUserAccountCreationRequestViewModel model, string createdBy);

        Task<NewUserAccountCreationRequest> RetrieveNewUserAccountCreationRequestAsync(string userEmail);

        Task<ServiceSingleRecordInsertOrUpdateResponse> UpdateUserAsync(CompanyUserManageViewModel model, string actionUser);

        Task<ServiceStatusResponse> UpdateUserPhoneNumberAndUserNameAsync(string userId, string phoneNumber);

        Task<bool> SetUserAccountCreationRequestAsDoneAsync(string userEmail);

        Task<ServiceSingleRecordInsertOrUpdateResponse> AttachUserToAnotherCompany(string currentUserId, long currentCompanyId, long targetCompanyId);

        Task<ServiceSingleRecordInsertOrUpdateResponse> DetachUserFromCompanyBackToOriginalCompany(string currentUserId, long currentCompanyId, string currentCompanyName);

        Task<DateTime> UpdateLoginTime();

        Task<DateTime> UpdateLogoutTime();
    }
}

感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

您应该按照错误消息中的描述实现接口的UpdateLoginTime(string)成员。您应该在Google的搜索栏中键入错误代码CS0535,然后您才能找到this

答案 1 :(得分:-1)

使用Visual Studio中修复的电位,它将自动添加以下代码:

        Task<UserInfo> IUserInfoService.UpdateLoginTimeAsync(string userId)
        {
            throw new NotImplementedException();
        }

        public Task<UserInfo> UpdateLogoutTimeAsync(string userId)
        {
            throw new NotImplementedException();
        }