public static async Task <DoctorHospitalViewModel> doctordelete(int ID, int hospitalid = 0) { var url = string.Format("api/Doctor/DoctorDelete?ID={0}&hospitalid={1}", ID, hospitalid); DoctorHospitalViewModel result = await ApiRequest <DoctorHospitalViewModel> .GetRequest(url); return(result); }
public ActionResult Create() { DoctorHospitalViewModel viewModel = new DoctorHospitalViewModel { Hospitals = hospitalRepository.GetAll() }; return(View(viewModel)); }
public async Task <ActionResult> doctordelete(int ID = 0) { int hospitalID = CookieHelper.getstaffHospitalID(); DoctorHospitalViewModel result = await DoctorApiRequestHelper.doctordelete(ID, hospitalID); if (result != null) { return(Json("Success", JsonRequestBehavior.AllowGet)); } else { return(Json("Fail", JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(DoctorHospitalViewModel viewModel) { // Check that viewModel is not null if (!ModelState.IsValid) { viewModel.Hospitals = hospitalRepository.GetAll(); return(View(viewModel)); } // Do what ever needs to be done // You can get the selected hospital id like this int selectedHospitalId = viewModel.HospitalId; return(RedirectToAction("List")); }
public HttpResponseMessage Delete(HttpRequestMessage request, int ID, int hospitalid = 0) { tbDoctor UpdatedDoctorEntity = new tbDoctor(); tbDoctorHospital UpdatedDoctorHospitalEntity = new tbDoctorHospital(); tbDoctor doctor = doctorRepo.Get().Where(a => a.ID == ID).FirstOrDefault(); tbDoctorHospital doctorhospital = doctorhospitalRepo.Get().Where(a => a.DoctorID == doctor.ID && a.HospitalID == hospitalid).FirstOrDefault(); doctor.IsDeleted = true; doctorhospital.IsDeleted = true; UpdatedDoctorEntity = doctorRepo.UpdatewithObj(doctor); UpdatedDoctorHospitalEntity = doctorhospitalRepo.UpdatewithObj(doctorhospital); DoctorHospitalViewModel dhvm = new DoctorHospitalViewModel(); dhvm.doctor = UpdatedDoctorEntity; dhvm.hospital = UpdatedDoctorHospitalEntity; return(request.CreateResponse <DoctorHospitalViewModel>(HttpStatusCode.OK, dhvm)); }