public HIVTestResultModel GetEdit(int?id)
        {
            HIVTestResultModel ee = new HIVTestResultModel();

            using (var testrep = new HIVTestResultRepository())
            {
                //PatientRepository pp = new PatientRepository();
                // var Pname = pp.GetAll().ToList().Find(x => x.PatientId == id);
                if (id.HasValue && id != 0)
                {
                    HIVTestResult test = testrep.GetById(id.Value);
                    ee.TestId      = test.TestId;
                    ee.PatientName = test.PatientName;
                    ee.Date        = test.Date;
                    //ee.DOB = Convert.ToDateTime(Pname.DOB);
                    // ee.Gender = Pname.Sex;
                    ee.TestigLocation  = test.TestigLocation;
                    ee.NextAppointment = test.NextAppointment;
                    ee.HIVtestType     = test.HIVtestType;
                    ee.Status          = test.Status;
                    ee.PatientId       = test.PatientId;
                }
                return(ee);
            }
        }
 public void PostDelete(int testmodel)
 {
     using (var testrep = new HIVTestResultRepository())
     {
         if (testmodel != 0)
         {
             HIVTestResult te = testrep.GetById(testmodel);
             testrep.Delete(te);
         }
     }
 }
        public HIVTestResultModel GetById(int?id)
        {
            HIVTestResultModel ee = new HIVTestResultModel();

            using (var parepo = new HIVTestResultRepository())
            {
                HIVTestResult test = parepo.GetById(id.Value);

                ee.TestId = test.TestId;

                return(ee);
            }
        }
        public HIVTestResultModel PostEdit(HIVTestResultModel id)
        {
            using (var testrep = new HIVTestResultRepository())
            {
                if (id.TestId == 0)
                {
                    HIVTestResult ee = new HIVTestResult
                    {
                        TestId = id.TestId,
                        //PatientName = id.PatientName,
                        Date = id.Date,
                        // DOB = id.DOB,
                        // Gender = id.Gender,
                        TestigLocation  = id.TestigLocation,
                        NextAppointment = id.NextAppointment,
                        HIVtestType     = id.HIVtestType,
                        Status          = id.Status,
                        //PatientId=id.PatientId
                    };
                    testrep.Create(ee);
                }
                else
                {
                    HIVTestResult test = testrep.GetById(id.TestId);

                    test.TestId = id.TestId;

                    //test.PatientName = id.PatientName;
                    test.Date = id.Date;
                    // test.DOB = id.DOB;
                    // test.Gender = id.Gender;
                    test.TestigLocation  = id.TestigLocation;
                    test.NextAppointment = id.NextAppointment;
                    test.HIVtestType     = id.HIVtestType;
                    test.Status          = id.Status;
                    //test.PatientId = id.PatientId;
                    testrep.update(test);
                }
                return(id);
            }
        }
        public HIVTestResultModel GetDelete(int?id)
        {
            HIVTestResultModel ee = new HIVTestResultModel();

            using (var testrep = new HIVTestResultRepository())
            {
                if (id != 0)
                {
                    HIVTestResult test = testrep.GetById(id.Value);
                    ee.TestId      = test.TestId;
                    ee.PatientName = test.PatientName;
                    ee.Date        = test.Date;
                    // ee.DOB = test.DOB;
                    // ee.Gender = test.Gender;
                    ee.TestigLocation  = test.TestigLocation;
                    ee.NextAppointment = test.NextAppointment;
                    ee.HIVtestType     = test.HIVtestType;
                    ee.Status          = test.Status;
                    ee.PatientId       = test.PatientId;
                }
                return(ee);
            }
        }