public ActionResult Add(int communityId, AddItemViewModel viewModel) { viewModel.PopulateSelectLists(); var cp = ((CustomPrincipal)User); //string toolName = viewModel.ItemName; //string warning = viewModel.Tool.Warnings; //int CategoryId = viewModel.CategoryId; //int rangeId = viewModel.AgeId; int?id = DatabaseHelper.Insert(@" insert into Item (Name, CategoriesId, AgeId, Warnings, CommunityId, PersonId) values (@Name, @CategoriesId, @AgeId, @Warnings, @CommunityId, @PersonId);", new SqlParameter("@Name", viewModel.Tool.Name), new SqlParameter("@CategoriesId", viewModel.Tool.CategoriesId), new SqlParameter("@AgeId", viewModel.Tool.AgeId), new SqlParameter("@Warnings", viewModel.Tool.Warnings), new SqlParameter("@CommunityId", communityId), new SqlParameter("@PersonId", cp.Person.Id) ); ; return(RedirectToAction("Index", "SearchItem", communityId)); }
public ActionResult Add(int communityId) { var viewModel = new AddItemViewModel(); viewModel.PopulateSelectLists(); return(View(viewModel)); }