/// <summary> /// save new treatment /// </summary> public TreatmentRes Save(int doctorId, TreatmentReq req) { try { using (TransactionScope scope = new TransactionScope()) { var cat = new catrecetas { idmedico = doctorId, nombre = req.GroupName, lineas = string.Join("|", req.List) }; Context.catrecetas.Add(cat); Context.SaveChanges(); scope.Complete(); return(new TreatmentRes { Id = cat.idcatreceta }); } } catch (Exception ex) { Log.Write($"WebAPI.Services.Diagnostic - Save=> {ex.Message}"); } return(new TreatmentRes()); }
//POST /api/treatments/1400 public TreatmentRes Post(int doctorId, [FromBody] TreatmentReq req) { return(service.Save(doctorId, req)); }