public string ResetOtp(int selectedUser)
        {
            var loggedinUser = LoginController.ActiveUser;
            var user         = _context.UserLoginInformations.Single(x => x.USERID.Equals(selectedUser));
            var userOtp      = new UserForgotMpinsOTP();
            var number       = GenerateOTP(11);

            try
            {
                using (var transactionScope = new TransactionScope())
                {
                    try
                    {
                        using (var db = new kryptoEntities1()) // Context object
                        {
                            userOtp.USERID       = selectedUser;
                            userOtp.OTPVAL       = number;
                            userOtp.STATUS       = 2;
                            userOtp.Notes        = "";
                            userOtp.CREATED_DATE = DateTime.Now;
                            userOtp.ModifiedDate = DateTime.Now;
                            userOtp.CreatedById  = loggedinUser.USERID.ToString();
                            userOtp.ModifiedById = loggedinUser.USERID.ToString();

                            db.Database.ExecuteSqlCommand("delete from UserForgotMpinsOTPS where UserId = {0}",
                                                          selectedUser);

                            db.UserForgotMpinsOTPS.Add(userOtp);
                            db.SaveChanges();
                        }

                        transactionScope.Complete();



                        bool x1 = SendOTPMail(number, user.EmailId, user.FirstName);
                        if (!x1)
                        {
                            return("Invalid Email");
                        }
                    }
                    catch (Exception ee)
                    {
                        return("FAIL");
                    }
                }
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                return("FAIL");
            }

            return("SUCESS");
        }
        public string ResetOtp(int selectedUser)
        {
            UserLoginInformation loggedinUser = (UserLoginInformation)LoginController.ActiveUser;
            UserLoginInformation user         = _context.UserLoginInformations.SingleOrDefault(x => x.USERID.Equals(selectedUser));
            UserForgotMpinsOTP   UserOtp      = new UserForgotMpinsOTP();
            string Number = GenerateOTP(11);

            try
            {
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    try
                    {
                        using (kryptoEntities1 db = new kryptoEntities1())     // Context object
                        {
                            UserOtp.USERID       = selectedUser;
                            UserOtp.OTPVAL       = Number;
                            UserOtp.STATUS       = 1;
                            UserOtp.Notes        = "";
                            UserOtp.CREATED_DATE = DateTime.Now;
                            UserOtp.ModifiedDate = DateTime.Now;
                            UserOtp.CreatedById  = loggedinUser.USERID.ToString();
                            UserOtp.ModifiedById = loggedinUser.USERID.ToString();

                            db.Database.ExecuteSqlCommand("delete from UserForgotMpinsOTPS where UserId = {0}", selectedUser);

                            db.UserForgotMpinsOTPS.Add(UserOtp);
                            db.SaveChanges();
                        }

                        transactionScope.Complete();

                        var msg = "Dear User, \n\n Your request to process the reset OTP is successful and your new OTP generated is  " + Number + " .  \n\n This is system generated message please do not reply.";

                        bool x1 = SendEmail("Your OTP has been reset", msg, user.EmailId, user.FirstName);
                        if (!x1)
                        {
                            return("Invalid Email");
                        }
                    }

                    catch (Exception ee)
                    {
                        return("FAIL");
                    }
                }
            }

            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                return("FAIL");
            }

            return("SUCESS");
        }