public IHttpActionResult Puttest_result(int id, test_result test_result)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != test_result.id)
            {
                return(BadRequest());
            }

            db.Entry(test_result).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!test_resultExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult Gettest_result(int id)
        {
            test_result test_result = db.test_result.Find(id);

            if (test_result == null)
            {
                return(NotFound());
            }

            return(Ok(test_result));
        }
        public IHttpActionResult Deletetest_result(int id)
        {
            test_result test_result = db.test_result.Find(id);

            if (test_result == null)
            {
                return(NotFound());
            }

            db.test_result.Remove(test_result);
            db.SaveChanges();

            return(Ok(test_result));
        }
        public void AddTestResult(TestResultDto TestResultDtoObj)
        {
            FreeLancer  FLancObj      = db.FreeLance.FirstOrDefault(f => f.ID == TestResultDtoObj.FreeLancerObjId);
            test        tObj          = db.test.FirstOrDefault(t => t.id == TestResultDtoObj.testObjId);
            test_result TestResultObj = new test_result()
            {
                Test_time     = DateTime.Now,
                test_Name     = TestResultDtoObj.test_Name,
                score         = TestResultDtoObj.score,
                FreeLancerObj = FLancObj,
                testObj       = tObj
            };

            db.test_result.Add(TestResultObj);
            db.SaveChanges();
        }