public bool CheckCredentials(string email, string password) { UserSearchCriteria criteria = new UserSearchCriteria { Email = email, Password = password }; EntityFrameworkRepositary <User> efr = new EntityFrameworkRepositary <User>(); User user = efr.Find(new FindByEmailSpecification(criteria)).SingleOrDefault(); if (user == null) { return(false); } return(true); }
public User GetUser(string email) { UserSearchCriteria criteria = new UserSearchCriteria { Email = email }; EntityFrameworkRepositary <User> efr = new EntityFrameworkRepositary <User>(); User user = efr.Find(new FindByEmailSpecification(criteria)).SingleOrDefault(); if (user == null) { return(null); } else { return(user); } }
static void Main(string[] args) { _contact = new EntityFrameworkRepositary <Contact>(); //var flag = true; var cbyname = _contact.Find(new FindByNameSpecification( new ContactSearchCriteriaByName { Name = "Himasnhu", Location = "Mumbai" } )); foreach (var contact in cbyname) { Console.WriteLine("Id " + contact.Id + " Name " + contact.Name + " Number " + contact.Number + " Location " + contact.Location); } //while (flag) //{ // Console.WriteLine("Enter the following KeyWord \nAdd Display Search SearchByName Delete Exit "); // string choice = Console.ReadLine(); // switch (choice.ToLower()) // { // case "add": // _contact.Add(Input()); // break; // case "display": // var contactList = _contact.Get(); // foreach (var contact in contactList) // { // Console.WriteLine("Id "+contact.Id + // " Name "+contact.Name + // " Number "+contact.Number+ // " Location "+contact.Location); // } // break; // case "search": // string ii = Console.ReadLine(); // var searchId = Guid.Parse(ii); // var c =_contact.GetById(searchId); // Console.WriteLine("Id " + c.Id + // " Name " + c.Name + // " Number " + c.Number + // " Location " + c.Location); // break; // case "searchbyname": // var cbyname =_contact.Find(new FindByNameSpecification( // new ContactSearchCriteriaByName // { // Name = "Himanshu", // Location = "Mumbai" // } // )); // foreach (var contact in cbyname) // { // Console.WriteLine("Id " + contact.Id + // " Name " + contact.Name + // " Number " + contact.Number + // " Location " + contact.Location); // } // break; // case "delete": // string i = Console.ReadLine(); // var id =Guid.Parse( i); // _contact.Delete(id); // break; // case "exit": // flag = false; // break; // default: Console.WriteLine("Enter Proper KeyWord"); // break; // } //} }