Example #1
0
        public string AllUsersLogin(string emailOrPhone, string pass)
        {
            var status = "Invalid Credentials";

            try
            {
                if (_AdminFacade.Auth(emailOrPhone, con.Encrypt(pass)) == "Logged in successful")
                {
                    return(_AdminFacade.GetAdminId(emailOrPhone));
                }
                else if (_UserFacade.Auth(emailOrPhone, con.Encrypt(pass)) == "Logged in successful")
                {
                    return(_UserFacade.GetUserId(emailOrPhone));
                }
                else if (_VendorFacade.AuthVendor(emailOrPhone, con.Encrypt(pass)) == "Logged in successful")
                {
                    return(_VendorFacade.GetVendorId(emailOrPhone));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                status = "Exception occured during validating credntials";
                throw e;
            }
            return(status);
        }
        public string AuthVendor([FromBody] Models.Vendors vendors)
        {
            var status = "Login failed";

            try
            {
                if (vendors.Email == "")
                {
                    vendors.Email = vendors.Pno;
                }
                status = _VendorFacade.AuthVendor(vendors.Email, con.Encrypt(vendors.Pass));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                status = "Login Failed";
                throw e;
            }
            return(status);
        }