Example #1
0
        public ActionResult <JournalEntryGroupPreset> Post(JournalEntryGroupPreset journalEntryPreset)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }

            _repository.Save(journalEntryPreset);
            return(journalEntryPreset);
        }
Example #2
0
        public void Post_with_model_ok_calls_repository()
        {
            var entityUnderTest = new PresetsController(_repository);
            var entity          = new JournalEntryGroupPreset
            {
                PresetEntries = new List <JournalEntryPresetEntry>
                {
                    new JournalEntryPresetEntry
                    {
                        Account = new Account {
                            AccountId = 5
                        },
                        DebitCredit = DebitCredit.Debit,
                        Order       = 1
                    }
                }
            };

            entityUnderTest.Post(entity);

            _repository.Received(1).Save(entity);
        }
 public void Save(JournalEntryGroupPreset journalEntryPreset)
 {
     _context.JournalEntryGroupPresets.Add(journalEntryPreset);
     _context.SaveChanges();
 }