Skip to content

Commit

Permalink
Merge pull request #13 from Shreyanshi210205/detailscheck_Shreyanshi2…
Browse files Browse the repository at this point in the history
…10205

feat: added the modifier in addPerson function
  • Loading branch information
MishraSomesh001 authored Mar 31, 2024
2 parents f8eeab9 + 99a047f commit 0d5a200
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions contract/Database.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ contract Database{
string name;
string DOB;
string phoneNo;

}
}

mapping( uint256=> Details) public list;

mapping (string => bool) public added;
uint256 public count=0;
constructor()
{

}

function addPerson(string calldata aadharId,string calldata name, string calldata DOB, string calldata phoneNo) public
modifier Added (string memory aadhar)
{
require(!added[aadhar],"Details already added");
_;
}

function addPerson(string calldata aadharId,string calldata name, string calldata DOB, string calldata phoneNo ) public Added (aadharId)
{
Details memory person = Details({aadharId: aadharId,name: name,DOB: DOB,phoneNo: phoneNo});
list[count]=person;
added[aadharId]=true;
count++;
}




Expand Down

0 comments on commit 0d5a200

Please sign in to comment.