Laalu Ar

Laalu Ar

  • NA
  • 20
  • 7.2k

Check three condition on login

Jun 25 2016 2:29 AM
hi, am new to mvc actually am trying to login with three condition 
 
 
 
problem (1) 
   if ( 1. login if email exist in emp table (or)2. login if email exist in user table )
   {
      
      return "succeslogin"; 
   }
   else if( 3. login if email exist in emp table for first time )
      { 
       
       return "succeslogin_first_time";
       } 
 }
else
{
 return "fails"; 
 
 In my C#
 
public class All
{
public string EmailId { get; set; }
public string Password { get; set; }
}
 
public partial class tblEmployee
{
public int Id { get; set; }
public long Emp_Id { get; set; }
public string Emp_Email { get; set; }
public string Emp_Name { get; set; }
public string Emp_Dept { get; set; }
public Nullable<long> Emp_Mobile { get; set; }
public Nullable<long> Emp_Payroll { get; set; }
public string Emp_Password { get; set; }
public Nullable<bool> Emp_FirstLog { get; set; }
}
public partial class tblUser
{
public int Id { get; set; }
public string Email { get; set; }
public string Password { get; set; }
}
 
 
public string LoginAttempt(All user)
{
var loginEmp = db.tblEmployees.FirstOrDefault(e => e.Emp_Email == user.EmailId);
var loginUser = db.tblUsers.FirstOrDefault(u => u.Email == user.EmailId);
if (loginEmp != null || loginUser != null)
{
return "loginsuccess";
}
else if (loginEmp.Emp_FirstLog == "true") // 
{
return "error";
}
else{
return "error";
}
}
 
 
 Error 1 Inconsistent accessibility: parameter type 'ServerControl.Controllers.All' is less accessible than method 'ServerControl.Controllers.LoginAcuteController.LoginAttempt(ServerControl.Controllers.All)'
 Error 2 Operator '==' cannot be applied to operands of type 'bool?' and 'string'
 
  
 Problem(2)
 
1.How can i check if email login  for first time 
2.How can i define in email login for first time in database
 
 
 
please help me to solve this issue  
 

Answers (1)