public SingleLargeTextModel getOnlineResumeLinkByUserId(int userid, int defaultId) { SingleLargeTextModel aSingleLargeTextModel = new SingleLargeTextModel(); using (SqlConnection aSqlConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "get_CareerAdjective_onlineResumeLink"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("userId", userid); cmd.Parameters.AddWithValue("defaultId", defaultId); cmd.Connection = aSqlConnection; aSqlConnection.Open(); SqlDataReader aSqlDataReader = cmd.ExecuteReader(); while (aSqlDataReader.Read()) { aSingleLargeTextModel.Id = Convert.ToInt32(aSqlDataReader["id"].ToString()); aSingleLargeTextModel.RepositorychildId = Convert.ToInt32(aSqlDataReader["repositorychildId"].ToString()); aSingleLargeTextModel.Data = aSqlDataReader["data"].ToString(); aSingleLargeTextModel.Description = aSqlDataReader["description"].ToString(); } } } return(aSingleLargeTextModel); }
public HttpResponseMessage UpdateSingleLargeTextModel(int id, [FromBody] SingleLargeTextModel singleLargeTextModel) { if (singleLargeTextModel == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "data with Id = " + id.ToString() + "not found to update")); } try { commonGateway.UpdateSingleLargeTextModel(singleLargeTextModel); return(Request.CreateResponse(HttpStatusCode.OK, singleLargeTextModel)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public int UpdateSingleLargeTextModel(SingleLargeTextModel singleLargeTextModel /*int userid, int defaultId*/) { int returnBool = 0; using (SqlConnection aSqlConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "Update_SingleLargeText_default"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("id", singleLargeTextModel.Id); cmd.Parameters.AddWithValue("repositorychildId", singleLargeTextModel.RepositorychildId); cmd.Parameters.AddWithValue("data", singleLargeTextModel.Data); cmd.Parameters.AddWithValue("description", singleLargeTextModel.Description); cmd.Parameters.Add("returnBool", SqlDbType.Int); cmd.Parameters["returnBool"].Direction = ParameterDirection.Output; cmd.Connection = aSqlConnection; try { aSqlConnection.Open(); Object obj = cmd.ExecuteReader(); returnBool = Convert.ToInt32(cmd.Parameters["returnBool"].Value); } catch (Exception ex) { //throw error } /*finally * { * aSqlConnection.Close(); * }*/ } } return(returnBool); }