Exemple #1
0
        public string InsertOTP(EventGuest guest, string ID)
        {
            HashPass hashedPass = new HashPass();
            string   pass       = HashPass.HashPassword(guest.PASS);

            using (EventrixDBDataContext db = new EventrixDBDataContext())
            {
                try
                {
                    int   _id      = Convert.ToInt32(ID);
                    var   query    = (from gst in db.Guests where gst.G_ID.Equals(_id) select gst).First();
                    Guest toUpdate = query;
                    toUpdate.Password = pass;
                    db.SubmitChanges();
                    return("success");
                }catch (Exception)
                {
                    return("fail");
                }
            };
        }
        public Host HostLogin(string email, string password)
        {
            HashPass hashedPass = new HashPass();
            string   pass       = HashPass.HashPassword(password);

            using (EventrixDBDataContext mde = new EventrixDBDataContext())
            {
                try
                {
                    return(mde.EventHosts.Where(pe => pe.Email == email && pe.Password == pass).Select(pe => new Host
                    {
                        ID = pe.EH_ID,
                        NAME = pe.Name,
                        EMAIL = pe.Email,
                        SURNAME = pe.Surname,
                        PASS = pe.Password,
                    }).First());
                }
                catch
                {
                    return(null);
                }
            };
        }