Пример #1
0
        public static void Delete(int id)
        {
            if (id < 0)
            {
                throw new Exception(LanguageDictionary.GetValue("DeleteNoteOperationInputError"));
            }
            var connection = SingltoneConnection.GetInstance();
            var rows       = connection.Delete <Note>(id);

            if (rows == 0)
            {
                throw new Exception(LanguageDictionary.GetFormatValue("DeleteNoteOperationUnknownError", id));
            }
        }
Пример #2
0
        public static Note Get(int id)
        {
            if (id < 0)
            {
                throw new Exception(LanguageDictionary.GetValue("GetNoteOperationInputError"));
            }
            var connection = SingltoneConnection.GetInstance();
            var res        = connection.Table <Note>().FirstOrDefault(o => o.Id == 2);

            if (res == null)
            {
                throw new Exception(LanguageDictionary.GetFormatValue("GetNoteOperationUnknownError", id));
            }
            return(res);
        }