public async Task <bool> DeleteExcelMapping(long userId, long id, string loginUserName) { Mappingexcel mappingExcel = await _dbTeleBilling_V01Context.Mappingexcel.FirstOrDefaultAsync(x => x.Id == id); List <Mappingexcel> mappingExcelMerge = new List <Mappingexcel>(); mappingExcelMerge = await _dbTeleBilling_V01Context.Mappingexcel.Where(x => x.MappedMappingId == id && x.IsCommonMapped == true).ToListAsync(); if (mappingExcelMerge != null) { _dbTeleBilling_V01Context.RemoveRange(mappingExcelMerge); await _dbTeleBilling_V01Context.SaveChangesAsync(); } if (mappingExcel != null) { mappingExcel.IsDelete = true; mappingExcel.UpdatedBy = userId; mappingExcel.UpdatedDate = DateTime.Now; _dbTeleBilling_V01Context.Update(mappingExcel); await _dbTeleBilling_V01Context.SaveChangesAsync(); List <Mappingexcelcolumn> excelcolumnlst = new List <Mappingexcelcolumn>(); excelcolumnlst = await _dbTeleBilling_V01Context.Mappingexcelcolumn.Where(x => x.MappingExcelId == mappingExcel.Id).ToListAsync(); if (excelcolumnlst != null) { _dbTeleBilling_V01Context.RemoveRange(excelcolumnlst); await _dbTeleBilling_V01Context.SaveChangesAsync(); } await _iLogManagement.SaveAuditActionLog((int)EnumList.AuditLogActionType.DeleteExcelMapping, loginUserName, userId, "Excel mapping", (int)EnumList.ActionTemplateTypes.Delete, mappingExcel.Id); return(true); } return(false); }