Commit d0d26139 authored by varsha's avatar varsha
Browse files

Update index.js

parent 14e0beec
Pipeline #31721 passed with stage
in 13 seconds
......@@ -47,17 +47,49 @@ router.post('/farmer_registration_form', function (req, res, next) {
Email:eml,
Password:pswd
}
Farmer.create(newlist,function(err,newone){
Farmer.findOne({User_name: req.body.uname}, function(err,uname) // checked where the entered username is already in farmers list
{
if(uname)
{
res.send('A farmer is already having this username please enter another username');
}
else
{
Farmer.findOne({mobileno:req.body.Mobile}, function(err,Mobile) //checked where the entered mobileno is already in farmers list
{
if(Mobile)
{
res.send('A farmer is already having this mobileno please enter another mobileno');
}
else
{
Farmer.findOne({email:req.body.email}, function(err,email) //checked where the entered email is already in farmers list
{
if(email)
{
res.send('A farmer is already having this email please enter another email-id');
}
else
{
Farmer.create(newlist,function(err,newlyCreated)
{
if (err)
{
console.log(err);
console.log(err);
}
else
{
res.redirect("/");
}
});
}
});
}
});
}
});
});
router.post('/customer_registration', function (req, res, next) {
var fullname=req.body.fullname;
var username=req.body.uname;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment