public ApiResult <string> Update(LabSample model) { try { this.labSampleRepository.UppdateLabSample(model); return(ApiResult <string> .Success(RecordConstants.Update)); } catch (Exception exception) { return(ApiResult <string> .Exception(this.logger.LogException(exception))); } }
public static async Task <LabSample> AddSample(IRequestContext context, long labId, long sampleId) { var labSample = new LabSample { LabId = labId, SampleId = sampleId, AssignedDate = DateTimeOffset.Now, Notes = "" }; context.DbContext.LabSamples.Add(labSample); await context.DbContext.SaveChangesAsync(); await context.LogAsync($"Added sample ID {sampleId} to lab ID {labId}"); return(labSample); }