public async Task <WeightMetric> CreateAsync(WeightMetric weightMetric, string uid)
 {
     try
     {
         await _context.WeightMetrics.AddAsync(weightMetric);
     }
     catch (Exception ex)
     {
         _logger.LogError("Couldn't create Weight Metric");
         _logger.LogError($"{ex.Message}");
         return(weightMetric);
     }
     return(weightMetric);
 }
 public async Task <WeightMetric> UpdateAsync(WeightMetric weightMetric, string uid)
 {
     try
     {
         _context.Entry(weightMetric).State = EntityState.Modified;
         await _context.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         _logger.LogError("Couldn't update Weight Metric");
         _logger.LogError($"{ex.Message}");
         return(weightMetric);
     }
     return(weightMetric);
 }
        public async Task <WeightMetric> Get(string uid)
        {
            try
            {
                WeightMetric wm = await _context.WeightMetrics
                                  .FirstOrDefaultAsync(w => w.UserId == uid);

                return(wm);
            }
            catch (Exception ex)
            {
                _logger.LogError("Couldn't get Weight Metric");
                _logger.LogError($"{ex.Message}");
                return(null);
            }
        }
 public async Task <WeightMetric> UpdateAsync(WeightMetric metric, string uid)
 {
     return(await _weightMetricRepository.UpdateAsync(metric, uid));
 }