/// <summary> /// save new diagnosis /// </summary> public DiagnosticsRes Save(int doctorId, DiagnosticsReq req) { try { using (TransactionScope scope = new TransactionScope()) { var cat = new catdiagnostico { idmedico = doctorId, nombre = req.GroupName, lineas = string.Join("|", req.List) }; Context.catdiagnostico.Add(cat); Context.SaveChanges(); scope.Complete(); return(new DiagnosticsRes { Id = cat.idcatdiagnostico }); } } catch (Exception ex) { Log.Write($"WebAPI.Services.Diagnostic - Save=> {ex.Message}"); } return(new DiagnosticsRes()); }
/// <summary> /// remove diagnoses from the doctor's /// diagnostic catalog /// </summary> public bool Delete(int diagnosticId) { var register = new catdiagnostico { idcatdiagnostico = diagnosticId }; Context.catdiagnostico.Attach(register); Context.catdiagnostico.Remove(register); try { Context.SaveChanges(); return(true); } catch (Exception ex) { Log.Write($"WebAPI.Services.Diagnostic - Delete => {ex.Message}"); } return(false); }