Esempio n. 1
0
        public bool Delete([FromBody] string errorMessage)
        {
            // code for writing to database
            AngularLoggingEntities angularLoggingEntities = new AngularLoggingEntities();

            var apiLogs = angularLoggingEntities.ApiLogs;

            angularLoggingEntities.ApiLogs.RemoveRange(apiLogs);
            angularLoggingEntities.SaveChanges();
            return(true);
        }
Esempio n. 2
0
        /*
         * Write now this code directly takes error string to be logged from Frontend.
         * We can modify our code for taking LogEntry Model and then build the error string.
         */

        // POST: api/Log
        public bool Post([FromBody] string errorMessage)
        {
            // code for writing to database
            AngularLoggingEntities angularLoggingEntities = new AngularLoggingEntities();

            angularLoggingEntities.ApiLogs.Add(new ApiLog()
            {
                ErrorMessage = errorMessage
            });
            angularLoggingEntities.SaveChanges();
            return(true);
        }