コード例 #1
0
        public async Task <int> Create(Meso meso)
        {
            meso.UserId = _identity.GetUserId();
            _context.Add(meso);
            await _context.SaveChangesAsync();

            return(meso.Id);
        }
コード例 #2
0
 public async Task <int> Update(Exercise exercise)
 {
     if (exercise == null || !_mesoService.GetUserMesocycles().Select(x => x.Id).Any(y => y == exercise.MesoId))
     {
         throw new NullReferenceException("Exercise could not be found");
     }
     _context.Update(exercise);
     return(await _context.SaveChangesAsync());
 }
コード例 #3
0
        public async Task Delete(int cardioId)
        {
            var cardioToRemove = await _context.FindAsync <Cardio>(cardioId);

            _context.Cardio.Remove(cardioToRemove);
            await _context.SaveChangesAsync();
        }