//Update DiagnosticCode public void UpdateDiagnosticCode(DiagnosticCodeDetail detail) { var entity = _ctx.DiagnosticCodes.Single(e => e.DiagnosticCodeId == detail.DiagnosticCodeId); entity.Name = detail.Name; entity.ICD10Code = detail.ICD10Code; entity.Price = detail.Price; _ctx.SaveChanges(); }
//Get DiagnosticCode by Id public DiagnosticCodeDetail GetDiagnosticCodeById(int diagnosticCodeId) { var diagnosticCodeEntity = _ctx.DiagnosticCodes.Find(diagnosticCodeId); var diagnosticCodeDetails = new DiagnosticCodeDetail { DiagnosticCodeId = diagnosticCodeEntity.DiagnosticCodeId, Name = diagnosticCodeEntity.Name, ICD10Code = diagnosticCodeEntity.ICD10Code, Price = diagnosticCodeEntity.Price, DiagnosisId = diagnosticCodeEntity.DiagnosisId, }; return(diagnosticCodeDetails); }
public ActionResult Edit(int id) { var service = new DiagnosticCodeService(); var detail = service.GetDiagnosticCodeById(id); var model = new DiagnosticCodeDetail { DiagnosticCodeId = detail.DiagnosticCodeId, Name = detail.Name, ICD10Code = detail.ICD10Code, Price = detail.Price, DiagnosisId = detail.DiagnosisId }; return(View(model)); }