示例#1
0
        public async Task <VerifyRecordResult> UpdateAsync(LeaveFormAdapterModel paraObject)
        {
            LeaveForm itemData = Mapper.Map <LeaveForm>(paraObject);

            CleanTrackingHelper.Clean <LeaveForm>(context);
            LeaveForm item = await context.LeaveForm
                             .AsNoTracking()
                             .FirstOrDefaultAsync(x => x.Id == paraObject.Id);

            if (item == null)
            {
                return(VerifyRecordResultFactory.Build(false, ErrorMessageEnum.無法修改紀錄));
            }
            else
            {
                CleanTrackingHelper.Clean <LeaveForm>(context);
                context.Entry(itemData).State = EntityState.Modified;
                await context.SaveChangesAsync();

                CleanTrackingHelper.Clean <LeaveForm>(context);
                return(VerifyRecordResultFactory.Build(true));
            }
        }
示例#2
0
        public async Task <VerifyRecordResult> BeforeDeleteCheckAsync(LeaveFormAdapterModel paraObject)
        {
            await Task.Yield();

            return(VerifyRecordResultFactory.Build(true));
        }