public ActionResult SendRequest(int cityId, int platform, int?subcatid, string contactnumber) { UserDetails objUserDetails = new UserDetails(); DataTable dtRequestSuggestion = new DataTable(); DataTable dtCategory = new DataTable(); DataTable dtContactId = new DataTable(); dtCategory = objUserDetails.GetSubCategory(null, subcatid == null?-1:subcatid, null).Tables[0]; int CatId = 0; int SubCategoryID = Convert.ToInt32(subcatid); if (dtCategory.Rows.Count > 0) { CatId = Convert.ToInt32(dtCategory.Rows[0]["CatId"]); } dtContactId = objUserDetails.GetContacts(null, null, contactnumber); if (dtContactId.Rows.Count == 0) { return(View()); } int ContactId = Convert.ToInt32(dtContactId.Rows[0]["ContactId"]); RequestSuggetions objRequestSugg = new RequestSuggetions(); objRequestSugg.cityId = cityId; objRequestSugg.platform = platform; objRequestSugg.categoryId = CatId; objRequestSugg.subCategoryId = SubCategoryID; objRequestSugg.contactId = ContactId; FillCategoryDrodown(CatId); FillSubCate(CatId, SubCategoryID); FillMicroCate(SubCategoryID); return(View(objRequestSugg)); }
public ActionResult SendRequest([Bind(Include = "categoryName,subcategoryName,microcategoryName,locationName,cityId,platform,comments,contactId")] RequestSuggetions reqSug) { if (ModelState.IsValid) { int catId = string.IsNullOrEmpty(reqSug.categoryName) == true ? 0 : Convert.ToInt32(reqSug.categoryName); int SubcatId = string.IsNullOrEmpty(reqSug.subcategoryName) == true ? 0 : Convert.ToInt32(reqSug.subcategoryName); int McatId = string.IsNullOrEmpty(reqSug.microcategoryName) == true ? 0 : Convert.ToInt32(reqSug.microcategoryName); UserDetails objUserDetails = new UserDetails(); if (objUserDetails.SaveRequestSuggestion(reqSug.uID, catId, SubcatId, McatId, reqSug.locationName, reqSug.cityId, reqSug.comments, reqSug.contactId, reqSug.platform)) { TempData["Success"] = "Added Successfully!"; } else { TempData["Success"] = "Some issue found!"; } FillCategoryDrodown(0); FillSubCate(0, 0); FillMicroCate(0); } return(View()); }