public async Task <bool> Create([FromBody] User user) { if (ModelState.IsValid) { _hrcContext.Add(user); try { await _hrcContext.SaveChangesAsync(); return(true); } catch (DbUpdateException) { return(false); } } return(false); }
public async Task <bool> Create([FromBody] Workout workout) { if (ModelState.IsValid) { workout.Id = Guid.NewGuid().ToString(); _hrcContext.Add(workout); try { await _hrcContext.SaveChangesAsync(); return(true); } catch (DbUpdateException) { return(false); } } return(false); }