Skip to content

Commit

Permalink
Merge pull request #14 from xTwo56/feat_addperson
Browse files Browse the repository at this point in the history
[Enhancement]: Input roll number and batch number in add person function
  • Loading branch information
MishraSomesh001 authored Mar 31, 2024
2 parents 0d5a200 + 36973b6 commit f0a4a61
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion contract/Database.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
pragma solidity >=0.7.0<0.9.0;

contract Database{

struct Details {
string aadharId;
string name;
string DOB;
string phoneNo;
string rollNo;
string batchNo;

}


}


mapping( uint256=> Details) public list;
mapping (string => bool) public added;
Expand All @@ -17,15 +24,20 @@ contract Database{
{

}


function addPerson(string memory aadharId,string memory name, string memory DOB, string memory phoneNo, string memory rollNo, string memory batchNo) 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});
Details memory person = Details({aadharId: aadharId,name: name,DOB: DOB,phoneNo: phoneNo, rollNo: rollNo, batchNo: batchNo});
list[count]=person;
added[aadharId]=true;
count++;
Expand Down

0 comments on commit f0a4a61

Please sign in to comment.