예제 #1
0
        private static void ProcessWriteToLog()
        {
            // get the person creating the log
            WriteLine("Enter Your Name");
            var userName = ReadLine();

            WriteLine("Enter your Log Entry");
            var logEntry = ReadLine();

            WriteLine(string.Format("Your Name: {0} \r\nYour Entry: {1}", userName, logEntry));
            WriteLine("Is this correct [y]es [n]o");

            var keypressed = ReadKey();

            var logEntryPoco = new LogEntry
            {
                Entry     = logEntry,
                CreatedBy = userName
            };

            switch (keypressed.KeyChar.ToString().ToLower().Trim())
            {
            case "y":
                _logEntryBusiness.SaveLogEntry(logEntryPoco);
                break;

            default:
                WriteLine("Entry Cancelled");
                break;
            }
        }
        public ActionResult Log(LoggerLogModel logModel)
        {
            var logEntry = new LogEntry
            {
                CreatedBy = logModel.CreatedBy,
                Entry     = logModel.LogEntry
            };

            _logEntryBusiness.SaveLogEntry(logEntry);

            return(ReturnLogResults());
        }