public async Task <int> SaveMember(Member member)

        {
            try

            {
                var result = await _dBContext.Member.AsNoTracking().Where(m => m.MemberID == member.MemberID).FirstOrDefaultAsync();

                if (result == null)

                {
                    var minresult = await _dBContext.Physician.AsNoTracking().MinAsync(x => x.PhysicianId);

                    var maxresult = await _dBContext.Physician.AsNoTracking().MaxAsync(x => x.PhysicianId);



                    Random random = new Random();

                    int randomPhysicianId = random.Next(maxresult);

                    member.PhysicianId = randomPhysicianId;



                    _dBContext.Member.Add(member);
                    string success = "added successfully";
                    //NLogger.loginfo("member added successfully");
                    var message = string.Format("response:{0}", success);
                    NLogger.Error(message);

                    await _dBContext.SaveChangesAsync();
                }

                else

                {
                    _dBContext.Member.UpdateRange(member);

                    await _dBContext.SaveChangesAsync();
                }
            }

            catch (Exception ex)

            {
                //throw ex;
                NLogger.Error(ex.Message);
            }
            return(member.MemberID);
        }
        public async Task <int> SaveClaims(ClaimDetails claimDetail)

        {
            try

            {
                ClaimTypes claimType = await _dBContext.ClaimTypes.AsNoTracking().Where(c => c.ClaimType == claimDetail.ClaimType).FirstOrDefaultAsync();

                Member member = await _dBContext.Member.AsNoTracking().Where(m => m.FirstName + " " + m.LastName == claimDetail.MemberName).FirstOrDefaultAsync();



                var claim = await _dBContext.Claims.AsNoTracking().Where(c => c.ClaimID == claimDetail.ClaimID).FirstOrDefaultAsync();

                if (claim == null)

                {
                    Claims claims = new Claims()

                    {
                        ClaimID = 0,

                        ClaimType = claimType.ClaimTypeID,

                        ClaimAmount = claimDetail.ClaimAmount,

                        ClaimDate = claimDetail.ClaimDate,

                        Remarks = claimDetail.Remarks,

                        MemberID = member.MemberID
                    };

                    _dBContext.Claims.Add(claims);

                    await _dBContext.SaveChangesAsync();
                }

                else

                {
                    claim = new Claims()

                    {
                        ClaimType = claimType.ClaimTypeID,

                        ClaimAmount = claimDetail.ClaimAmount,

                        ClaimDate = claimDetail.ClaimDate,

                        Remarks = claimDetail.Remarks,

                        MemberID = member.MemberID
                    };

                    _dBContext.Claims.UpdateRange(claim);

                    await _dBContext.SaveChangesAsync();
                }

                return(claimDetail.ClaimID);
            }

            catch (Exception ex)

            {
                throw ex;
            }
        }