Пример #1
0
        public IActionResult PatientInformationUpdate(HastalikTakibi.Models.PatientInformationVM patientInformation)
        {
            var patientInformationDb = _hastlikTakipDbContext.PatientInformation.Where(a => a.Id == patientInformation.Id).FirstOrDefault();

            if (patientInformationDb == null)
            {
                ViewBag.Error = "Hasta Bulunamadı";
                return(RedirectToAction("Index"));
            }
            patientInformationDb.Id           = patientInformation.Id;
            patientInformation.CategoryId     = patientInformation.CategoryId;
            patientInformationDb.DiseaseId    = patientInformation.DiseaseId;
            patientInformationDb.DistrictId   = patientInformation.DistrictId;
            patientInformationDb.Latitude     = patientInformation.Latitude;
            patientInformationDb.Longitude    = patientInformation.Longitude;
            patientInformationDb.PatientId    = patientInformation.PatientId;
            patientInformationDb.ProvinceId   = patientInformation.ProvinceId;
            patientInformationDb.RecoveryTime = patientInformation.RecoveryTime;
            patientInformationDb.Symptoms     = patientInformation.Symptoms;
            patientInformationDb.WhenIll      = patientInformation.WhenIll;
            _hastlikTakipDbContext.Entry(patientInformationDb).State = Microsoft.EntityFrameworkCore.EntityState.Modified;



            _hastlikTakipDbContext.SaveChangesAsync().GetAwaiter().GetResult();
            return(RedirectToAction("PatientInformation", new { id = patientInformationDb.PatientId }));
        }
Пример #2
0
        public IActionResult PatientInformationAdd(HastalikTakibi.Models.PatientInformationVM patientInformation)
        {
            if (patientInformation == null || patientInformation.DiseaseId <= 0 || patientInformation.PatientId <= 0)
            {
                ViewBag.eror = "zorunlu alanları doldurunuz";
                int categoryId = SetCategory();
                SetDisease(categoryId);
                int plateNumber = SetProvince();
                SetDistrict(plateNumber);
                return(View(patientInformation));
            }
            var patientknownDb = new PatientInformation()
            {
                PatientId    = patientInformation.PatientId,
                DiseaseId    = patientInformation.DiseaseId,
                WhenIll      = patientInformation.WhenIll,
                RecoveryTime = patientInformation.RecoveryTime,
                ProvinceId   = patientInformation.ProvinceId,
                DistrictId   = patientInformation.DistrictId,
                Latitude     = patientInformation.Latitude,
                Longitude    = patientInformation.Longitude,
                Symptoms     = patientInformation.Symptoms,
                CategoryId   = patientInformation.CategoryId
            };

            _hastlikTakipDbContext.PatientInformation.Add(patientknownDb);
            _hastlikTakipDbContext.SaveChangesAsync().GetAwaiter().GetResult();
            return(RedirectToAction("PatientInformation", new { id = patientknownDb.PatientId }));
        }