General.Services/Note/NoteService.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using General.Core.Data;
using General.Entities.Models;
using Microsoft.EntityFrameworkCore;
using System.Linq;

namespace General.Services.Note
{
    public class NoteService : INoteService
    {
        private readonly IRepository<tc_note> tc_NoteRepository;

        public NoteService(IRepository<tc_note> tc_noteRepository)
        {
            tc_NoteRepository = tc_noteRepository;
        }

        /// <summary>
        /// 删除便签
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<int> DeleteInfo(int id)
        {
            var model = await tc_NoteRepository.getByIdAsync(id);
            var res = await tc_NoteRepository.DeleteAsync(model);
            return res;
        }

        /// <summary>
        /// 获取所有便签
        /// </summary>
        /// <returns></returns>
        public async Task<List<tc_note>> GetAllList()
        {
            return await tc_NoteRepository.GetAllAsync().OrderBy(x=>x.id).ToListAsync();
        }

        /// <summary>
        /// 更新便签
        /// </summary>
        /// <param name="id"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public async Task<int> UpdateInfo(int id, string message)
        {
            var model = await tc_NoteRepository.getByIdAsync(id);
            model.message = message;
            return await tc_NoteRepository.UpdateAsync(model);
        }


        /// <summary>
        /// 增加便签
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<int> AddInfo(string message,int uid)
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。