public IDataLoadResult SetDataLoadResult(IDataLoadResult value) { using (var context = new RioValleyChiliDataContext()) { var result = context.DataLoadResult.ToList().OrderBy(r => r.Id).LastOrDefault() ?? context.DataLoadResult.Add(new Models.DataLoadResult()); result.Success = value.Success; result.RanToCompletion = value.RanToCompletion; result.TimeStamp = value.TimeStamp; context.SaveChanges(); } return(value); }
public IDataLoadResult GetDataLoadResult() { try { using (var context = new RioValleyChiliDataContext()) { return(context.DataLoadResult.ToList().OrderBy(r => r.Id).LastOrDefault()); } } catch (Exception) { return(new LoadResult { Success = false, }); } }