protected void addBuildingButton_Click(Object sender, EventArgs e) { if (Page.IsValid) { BuildingModel newBuilding = new BuildingModel(); newBuilding.BuildingName = inBuildingName.Value; newBuilding.BuildingLabel = inBuildingLabel.Value; newBuilding.RoomQty = Convert.ToInt32(inRoomQty.Value); BuildingBL.ProcessAddNewBuilding(newBuilding); Response.Redirect("AdminHome.aspx"); } }
//Takes the event information from the button click in the user interaction layer and processes insertion into the database protected void addBuildingButton_Click(Object sender, EventArgs e) { //Uses ASP.NET function IsValid() to test user input and the current error state before proceeding if (Page.IsValid) { BuildingModel newBuilding = new BuildingModel(); //Creates a new BuildingModel instance //Sets relevant values from user input newBuilding.BuildingName = inBuildingName.Value; newBuilding.BuildingLabel = inBuildingLabel.Value; newBuilding.RoomQty = Convert.ToInt32(inRoomQty.Value); //Adds a new building to the database BuildingBL.ProcessAddNewBuilding(newBuilding); //Redirects the user to the administrator home panel after processing is completed Response.Redirect("AdminHome.aspx"); } }