public ActionResult UnpinAccount(int id)
        {
            Pin_Accounts pin = service.findPinAccount(id);

            pin.is_active = 0;
            service.save();
            int identity = Convert.ToInt32(Session["adminId"]);

            return(RedirectToAction("index", new { ID = identity }));
        }
        public ActionResult PinAccounts(int id, FormCollection collection)
        {
            if (Session["name"] != "Admin")
            {
                service.deActivePinAccountsOfUser(id);
            }
            else
            {
                service.deActivePinAccountsOfAdmin(id);
            }
            foreach (var accName in service.allTransactionAccounts())
            {
                if (Request.Form[accName.name] != null)
                {
                    Pin_Accounts pin = new Pin_Accounts();

                    if (Session["name"] != "Admin")
                    {
                        string value = Request.Form[accName.name];
                        pin.User_id      = id;
                        pin.Account_id   = accName.id;
                        pin.User_type    = "User";
                        pin.Account_name = accName.name;
                        pin.is_active    = 1;
                    }
                    else
                    {
                        string value = Request.Form[accName.name];
                        pin.Admin_id     = id;
                        pin.Account_id   = accName.id;
                        pin.User_type    = "Admin";
                        pin.Account_name = accName.name;
                        pin.is_active    = 1;
                    }

                    service.addPinAccounts(pin);
                    service.save();
                }
            }
            return(RedirectToAction("PinAccounts"));
        }
 public void addPinAccounts(Pin_Accounts pin)
 {
     db.Pin_Accounts.Add(pin);
 }