Ejemplo n.º 1
0
 public IHttpActionResult updateJob(int id, Job_Offer job)
 {
     try
     {
         using (SqlConnection con = new SqlConnection(conn))
         {
             SqlDataAdapter da = new SqlDataAdapter("SELECT * from Job_Offer where job_ID = '" + id + "'", con);
             DataTable      dt = new DataTable();
             da.Fill(dt);
             if (dt != null)
             {
                 con.Open();
                 SqlCommand cmd = new SqlCommand("jobUpdate", con);
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@job_ID", job.job_ID);
                 cmd.Parameters.AddWithValue("@can_ID", job.can_ID);
                 cmd.Parameters.AddWithValue("@Salary", job.Salary);
                 cmd.Parameters.AddWithValue("@Joining_Date", job.Joining_Date);
                 cmd.ExecuteNonQuery();
                 con.Close();
             }
             else
             {
                 return(Json(new { Status = false, Message = (id.ToString() + " is not Exist") }));
             }
         }
     }
     catch (Exception ex)
     {
         return(Json(new { Status = false, Message = ex.Message, Data = "" }));
     }
     return(Json(new { Status = true, Message = "Data Successfull Updated" }));
 }
Ejemplo n.º 2
0
 public IHttpActionResult insertJob(Job_Offer job)
 {
     try
     {
         using (SqlConnection con = new SqlConnection(conn))
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("jobInsert", con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@can_ID", job.can_ID);
             cmd.Parameters.AddWithValue("@Salary", job.Salary);
             cmd.Parameters.AddWithValue("@Joining_Date", job.Joining_Date);
             cmd.ExecuteNonQuery();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         return(Json(new { Status = false, Message = ex.Message, Data = "" }));
     }
     return(Json(new { Status = true, Message = "Data Successfull Inserted" }));
 }