public static bool PersonLogin(string Us, string Pas) { try { using (var db = new Modals.Context()) { var res = db.Persons.Where(i => i.UserName == Us || i.Email == Us) .Where(i => i.Password == Security.Hash_SHA256.CreatHash256(Pas)).FirstOrDefault(); if (res != null) { MainRoot.SetRoot(res.UserName, res.FullName, res.AccessLevel, res.Email, res.PhoneNumber, res.Cart); return(true); } else { return(false); } } } catch (Exception ex) { throw ex; } }
public static bool LogOut() { MainRoot.SetRoot(null); return(true); }