public HttpResponseMessage Insert([FromBody] JobComplaints JobComplaints)
        {
            _JobComplaintsRepo.InsertJobComplaintsDetailsAsync(JobComplaints);

            var message = Request.CreateResponse(HttpStatusCode.Created, JobComplaints);

            message.Headers.Location = new Uri(Request.RequestUri + JobComplaints.Id.ToString());
            return(message);
        }
        public void InsertJobComplaintsDetailsAsync(JobComplaints jobAssign)
        {
            if (myconn.State != ConnectionState.Open)
            {
                myconn.Open();
            }

            SqlTransaction tran = myconn.BeginTransaction();

            jobAssign.createdDate  = DateTime.Now;
            jobAssign.modifiedDate = DateTime.Now;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandType = CommandType.StoredProcedure;
            sqlCmd.CommandText = "SP_JobComplaintsInsertUpdate";
            sqlCmd.Parameters.Add(new SqlParameter("@mode", "I"));
            sqlCmd.Parameters.Add(new SqlParameter("@Id", jobAssign.Id));
            sqlCmd.Parameters.Add(new SqlParameter("@jobID", jobAssign.jobID));
            sqlCmd.Parameters.Add(new SqlParameter("@compliantDesc", jobAssign.compliantDesc));
            sqlCmd.Parameters.Add(new SqlParameter("@memberId", jobAssign.memberId));
            sqlCmd.Parameters.Add(new SqlParameter("@subcontractorID", jobAssign.subcontractorID));
            sqlCmd.Parameters.Add(new SqlParameter("@dueDate", jobAssign.dueDate));
            sqlCmd.Parameters.Add(new SqlParameter("@priority", jobAssign.priority));
            sqlCmd.Parameters.Add(new SqlParameter("@createdDate", jobAssign.createdDate));
            sqlCmd.Parameters.Add(new SqlParameter("@modifiedDate", jobAssign.modifiedDate));
            sqlCmd.Parameters.Add(new SqlParameter("@userId", jobAssign.userId));


            try
            {
                sqlCmd.Connection  = myconn;
                sqlCmd.Transaction = tran;

                jobAssign.Id = Convert.ToInt32(sqlCmd.ExecuteScalar());

                // InsertJobComplaintsRateDetailsAsync(JobComplaintsRates, JobComplaints.JobComplaintsID, tran);
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                gs.LogData(ex);
                throw ex;
            }
            finally
            {
                if (myconn.State != ConnectionState.Closed)
                {
                    myconn.Close();
                }
            }
        }
 public async void Update([FromBody] JobComplaints JobComplaints)
 {
     await Task.Run(() => _JobComplaintsRepo.UpdateJobComplaintsDetailsAsync(JobComplaints));
 }