示例#1
0
        public async Task <bool> Create(CallType CallType)
        {
            CallTypeDAO CallTypeDAO = new CallTypeDAO();

            CallTypeDAO.Id        = CallType.Id;
            CallTypeDAO.Code      = CallType.Code;
            CallTypeDAO.Name      = CallType.Name;
            CallTypeDAO.ColorCode = CallType.ColorCode;
            CallTypeDAO.StatusId  = CallType.StatusId;
            CallTypeDAO.Used      = CallType.Used;
            CallTypeDAO.CreatedAt = StaticParams.DateTimeNow;
            CallTypeDAO.UpdatedAt = StaticParams.DateTimeNow;
            DataContext.CallType.Add(CallTypeDAO);
            await DataContext.SaveChangesAsync();

            CallType.Id = CallTypeDAO.Id;
            await SaveReference(CallType);

            return(true);
        }
示例#2
0
        public async Task <bool> BulkMerge(List <CallType> CallTypes)
        {
            List <CallTypeDAO> CallTypeDAOs = new List <CallTypeDAO>();

            foreach (CallType CallType in CallTypes)
            {
                CallTypeDAO CallTypeDAO = new CallTypeDAO();
                CallTypeDAO.Id        = CallType.Id;
                CallTypeDAO.Code      = CallType.Code;
                CallTypeDAO.Name      = CallType.Name;
                CallTypeDAO.ColorCode = CallType.ColorCode;
                CallTypeDAO.StatusId  = CallType.StatusId;
                CallTypeDAO.Used      = CallType.Used;
                CallTypeDAO.CreatedAt = StaticParams.DateTimeNow;
                CallTypeDAO.UpdatedAt = StaticParams.DateTimeNow;
                CallTypeDAOs.Add(CallTypeDAO);
            }
            await DataContext.BulkMergeAsync(CallTypeDAOs);

            return(true);
        }
示例#3
0
        public async Task <bool> Update(CallType CallType)
        {
            CallTypeDAO CallTypeDAO = DataContext.CallType.Where(x => x.Id == CallType.Id).FirstOrDefault();

            if (CallTypeDAO == null)
            {
                return(false);
            }
            CallTypeDAO.Id        = CallType.Id;
            CallTypeDAO.Code      = CallType.Code;
            CallTypeDAO.Name      = CallType.Name;
            CallTypeDAO.ColorCode = CallType.ColorCode;
            CallTypeDAO.StatusId  = CallType.StatusId;
            CallTypeDAO.Used      = CallType.Used;
            CallTypeDAO.UpdatedAt = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(CallType);

            return(true);
        }