GMS.Crm.BLL/CrmService.cs

(开头部分) 11KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GMS.Crm.Contract;
using GMS.Crm.DAL;
using GMS.Framework.Utility;
using System.Data.Objects;
using GMS.Framework.Contract;
using EntityFramework.Extensions;
using GMS.Core.Cache;

namespace GMS.Crm.BLL
{
    public class CrmService : ICrmService
    {
        #region Project CURD
        public Project GetProject(int id)
        {
            using (var dbContext = new CrmDbContext())
            {
                return dbContext.Find<Project>(id);
            }
        }

        public IEnumerable<Project> GetProjectList(ProjectRequest request = null)
        {
            request = request ?? new ProjectRequest();
            using (var dbContext = new CrmDbContext())
            {
                IQueryable<Project> projects = dbContext.Projects;

                if (!string.IsNullOrEmpty(request.Name))
                    projects = projects.Where(u => u.Name.Contains(request.Name));

                return projects.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
            }
        }

        public void SaveProject(Project project)
        {
            using (var dbContext = new CrmDbContext())
            {
                if (project.ID > 0)
                {
                    dbContext.Update<Project>(project);
                }
                else
                {
                    dbContext.Insert<Project>(project);
                }
            }
        }

        public void DeleteProject(List<int> ids)
        {
            using (var dbContext = new CrmDbContext())
            {
                dbContext.Projects.Where(u => ids.Contains(u.ID)).Delete();
            }
后面还有 227 行代码,购买后查看完整代码

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

AI 解读

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

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