public ActionResult NewGallery(test1.Models.Gallery model) { bool TheResult = false; if (ModelState.IsValid) { Connection.Connection con = new Connection.Connection(); if (User.Identity.GetUserId() != null) { string[] words = model.Ga_Deleteable.Split(' '); foreach (string word in words) { model.Photoes.RemoveAt(Int32.Parse(word)); } TheResult = con.AddGallery(model); } } if (TheResult == true) { return(RedirectToAction("Index", "Manage", new { Message = Models.ManageMessageId.AddGallerySuccess })); } else { return(View()); } }