public void bntCreate_Click(Object sender, EventArgs e) { var id = Page.Request.Params["id"]; var track = new Tracks { Name = tbName.Text, ManagerID = Convert.ToInt32(ddlManager.SelectedValue) }; if (id == null) { track.Create(); } else { track.ID = Convert.ToInt32(id); track.Update(); } Page.Response.Redirect("~/ManagerUI/Menu/Souls/TracksView.aspx"); }