protected void submitProj_Click(object sender, EventArgs e) { string categories = ""; int count = 0; bool valid = true; int result = 0; foreach (ListItem item in cblCat.Items) { if (item.Selected) { categories += item.Value + " "; count++; } } if (count == 0) { Toast.error(this, "Please check at least one category"); } if (ValidateInput(title.Value, tbcontent.Value)) { User user = new User().SelectById(currUserId); Portfolio port = new Portfolio(user.Id, title.Value, categories, tbcontent.Value, ""); if (upPoster.HasFile) { valid = storeTemp(); } if (valid) { result = port.AddPortfolio(); } if (upPoster.HasFile) { storeFile(result.ToString()); } if (result == 0) { Toast.error(this, "An error occured while adding project"); } else { if (upPoster.HasFile) { storeFile(result.ToString()); } Session["success"] = "Project created successfully"; Response.Redirect("~/Views/profile/index.aspx"); } } }