public void Add(UserSetting UserSetting)
        {
            var fileName = "";

              unitOfWork.usersettingrepository.Add(UserSetting);
            unitOfWork.Save();
            unitOfWork.Dispose();
        }
        public ActionResult Create(UserSetting usersetting)
        {
            if (ModelState.IsValid)
            {
                db.UserSettings.Add(usersetting);
                db.SaveChanges();
                return RedirectToAction("Index", new { userID = WebSecurity.CurrentUserId });
            }

            return View(usersetting);
        }
 public void Update(UserSetting mt)
 {
     throw new NotImplementedException();
 }
        public ActionResult EmailConfirmation(string id)
        {
            if (WebSecurity.ConfirmAccount(id))
            {
                //get the userid from confirmationtoken.
                //then get the username or emailaddress for this account
                //update contactlist with this userid for this emailaddress/username
                UserSetting us = new UserSetting();
                us.ReceiveEmailNotification = 1;
                us.ReceiveMobileTextNotification = 0;
                us.NotificationFrequencyID = 3;
                us.PrivacySettingsID = 3;
                us.ActivityTypeID = 1;
                us.UserID = dbmeals.webpages_Membership.Where(x => x.ConfirmationToken == id).FirstOrDefault().UserId;

                dbmeals.UserSettings.Add(us);

                dbmeals.SaveChanges();
                us.ActivityTypeID = 2;
                dbmeals.UserSettings.Add(us);

                dbmeals.SaveChanges();
                us.ActivityTypeID = 3;
                dbmeals.UserSettings.Add(us);

                dbmeals.SaveChanges();
                us.ActivityTypeID = 4;
                dbmeals.UserSettings.Add(us);

                dbmeals.SaveChanges();

                string userName = db.UserProfiles.Where(x => x.UserId == us.UserID).FirstOrDefault().UserName;

                //LoginRegisterViewModel viewmodel=new LoginRegisterViewModel();
                //viewmodel.FirstName=lm.FirstName;
                // viewmodel.UserName=lm.UserName;
                //viewmodel.Password=dbmeals.webpages_Membership.Where(x => x.ConfirmationToken == id).FirstOrDefault().Password;
                // return Login(viewmodel,null);
                FormsAuthentication.SetAuthCookie(userName, true);

                return RedirectPage(us.UserID);
            }
            return RedirectToAction("ConfirmationFailure");
        }