public ResultViewModel Insert([FromBody] Instrument instrument) { try { _context.Add(instrument); _context.SaveChanges(); return(new ResultViewModel(Result.Success, instrument.Name + " was successfully created.")); } catch (Exception ex) { return(new ResultViewModel(Result.Error, "Could not create " + instrument.Name + ". Try again later.", ex)); } }
public ResultViewModel Insert([FromBody] PracticeSession practiceSession) { try { _context.Add(practiceSession); _context.SaveChanges(); return(new ResultViewModel(Result.Success, "Practice Session was successfully created.")); } catch (Exception ex) { return(new ResultViewModel(Result.Error, "Could not create Practice Session. Try again later.", ex)); } }