private NotepadEntity GetNotePadEntity(ErrorLogEntity errorLogEntity) { var notePadEntity = new NotepadEntity(); notePadEntity.Name = "ErrorLogs"; notePadEntity.FilePath = @"c:\Temp\Log\ErrorLogs.txt"; notePadEntity.Description = "desc"; notePadEntity.Contents = $"ControllerName {errorLogEntity.ControllerName} StackTrace {errorLogEntity.StackTrace} TimeStamp {errorLogEntity.TimeStamp}"; return(notePadEntity); }
public int AppendInNotePad(NotepadEntity notePadEntity) { try { File.AppendAllLines(notePadEntity.FilePath, ConvertToIEnumerableString(notePadEntity.Contents)); return(0); } catch (Exception ex) { return(1); } }
public string GetAllNotepad(NotepadEntity notePadEntity) { try { if (File.Exists(notePadEntity.FilePath)) { var text = File.ReadAllText(notePadEntity.FilePath); return(text); } else { return("File does not exist"); } } catch (Exception ex) { return("File does not exist"); } }
public int EditNotePad(NotepadEntity notePadEntity) { try { if (File.Exists(notePadEntity.FilePath)) { File.WriteAllText(notePadEntity.FilePath, notePadEntity.Contents); return(0); } else { return(1); } } catch (Exception ex) { return(1); } }