public async Task <int> Create(Meso meso) { meso.UserId = _identity.GetUserId(); _context.Add(meso); await _context.SaveChangesAsync(); return(meso.Id); }
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()); }
public async Task Delete(int cardioId) { var cardioToRemove = await _context.FindAsync <Cardio>(cardioId); _context.Cardio.Remove(cardioToRemove); await _context.SaveChangesAsync(); }