Submit a Form in a View with an array.

I have a View that I need to update to a form submit for security reasons.  I need to be able to use HttpPost instead of HttpGet for my controller action.  I need help converting this.  

The controller is:

 [HttpPost]
        public ActionResult SelectType(int type)
        {
            if (user.bomDetails.type != type)
            {
                List<tbl_Cart> cartItems = (from x in bomDB.tbl_Cart
                                            where x.UserID == user.id
                                            select x).ToList();

                foreach (tbl_Cart cartItem in cartItems)
                {
                    bomDB.tbl_Cart.Remove(cartItem);
                }
            }

            tbl_User_Bom bomUserMe = (from x in bomDB.tbl_User_Bom
                                      where x.ID == user.id
                                      select x).Single();
            bomUserMe.Type = type;
            bomDB.SaveChanges();

            return RedirectToAction("GeneralInfo");
        }

The current View has the following:

@model master.Areas.BillofMaterial.Models.tbl_Type[,]
@{
    ViewBag.Title = "Home";
    master.Areas.BillofMaterial.Models.tbl_Cart cart = new master.Areas.BillofMaterial.Models.tbl_Cart();
    Layout = "~/Areas/BillofMaterial/Views/Shared/_Layout.cshtml";
}

@for (int i = 0; i < Model.GetLength(0); i++)
{
    <div class="row">
        @for (int j = 0; j < Model.GetLength(1); j++)
        {
            string offset = "col-xs-offset-2";
            bool isCurrent, isNull;
            if (j == 0)
            {
                offset = "col-xs-offset-1";
            }
           
            try
            {
                isNull = Model[i, j].Description.Length < 1;
            }
            catch
            {
                isNull = true;
            }
           
            if (!isNull)
            {
                isCurrent = ViewBag.myType != Model[i, j].ID && cart.CountCart > 0;
                string x = isCurrent ? "true" : "false";
               
                <div class="col-xs-2 @offset" style="height: 75px;">
                    <button type="button" class="btn btn-success" style="height: 100%; width: 100%; white-space: normal;" onclick="if(@x && confirm('You are about to empty your cart')){window.location = '@Url.Action("SelectType", new { @type = Model[i, j].ID })'} else if(!@x){window.location = '@Url.Action("SelectType", new { @type = Model[i, j].ID })'}">
                        @Model[i, j].Description
                    </button>
                </div>
            }
        }
    </div>
}

I know I have to use a  @using (Html.BeginForm with a Hidden Field for the Type. I just don't know how to do this with an array.
Crystal RouseTask LeadAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Crystal RouseTask LeadAuthor Commented:
I was able to figure this one out on my own.  Closing this question.  I just needed to pass in the correct parameters.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
arrays

From novice to tech pro — start learning today.