Esempio n. 1
0
        public void Add(TodoModel entity)
        {
            this.conn.CreateTable <TodoModel>();

            // mock data
            entity.Create = DateTime.Now;
            entity.Status = 1;

            this.conn.Insert(entity);
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Modify);

            taskID = Intent.GetIntExtra("taskID", -1);

            if (taskID != -1)
            {
                this.task = new Database().Get(taskID);
                FindViewById <EditText>(Resource.Id.etTitle).Text   = this.task.Title;
                FindViewById <EditText>(Resource.Id.etContent).Text = this.task.Content;
            }
        }
Esempio n. 3
0
        private TodoModel GetModel()
        {
            var title   = FindViewById <EditText>(Resource.Id.etTitle).Text;
            var content = FindViewById <EditText>(Resource.Id.etContent).Text;

            if (this.taskID == -1)
            {
                var entity = new TodoModel()
                {
                    Title   = title,
                    Content = content
                };

                return(entity);
            }
            else
            {
                task.Title   = title;
                task.Content = content;

                return(task);
            }
        }
Esempio n. 4
0
 public bool Update(TodoModel model)
 {
     this.conn.Update(model);
     return(true);
 }