private BreakLogEntry CreateBreakEntry(Terminal currentTerminal, string reasonText)
        {
            BreakLogEntry breakLog = new BreakLogEntry
            {
                BreakReason    = reasonText,
                BreakStartTime = DateTime.Now,
                TerminalId     = currentTerminal.Id,
                BreakState     = BreakState.Open
            };

            _unitOfWork.BreakLogEntries.Create(breakLog);
            var breakLogCommand = new CreateBreakLogEntryCommand(breakLog);

            _unitOfWork.SourceEvent(breakLogCommand);
            return(breakLog);
        }
Exemple #2
0
        public ActionResult <BreakLogEntry> CreateBreakLogEntry([FromBody] BreakLogEntry breakLogEntry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                _unitOfWork.BreakLogEntries.Create(breakLogEntry);

                var createBreakLogEntryCommand = new CreateBreakLogEntryCommand(breakLogEntry);
                _unitOfWork.SourceEvent(createBreakLogEntryCommand);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Ok(breakLogEntry));
        }