Esempio n. 1
0
        public static async Task <e.shared.ActionResult> Update(e.user_account obj)
        {
            using (var db = d.ConnectionFactory())
            {
                obj.modified_date = DateTime.Now;

                await db.ExecuteAsync(d.Update <e.user_account>(), obj);

                return(new e.shared.ActionResult {
                    Status = e.shared.Status.Success
                });
            }
        }
Esempio n. 2
0
        public static async Task <e.shared.ActionResult> Insert(e.user_account obj)
        {
            using (var db = d.ConnectionFactory())
            {
                obj.creation_date = DateTime.Now;
                obj.modified_date = DateTime.Now;

                int id = await db.ExecuteScalarAsync <int>(d.InsertAutoId <e.user_account>(), obj);

                return(new e.shared.ActionResult {
                    Status = e.shared.Status.Success, Value = id
                });
            }
        }
Esempio n. 3
0
        public void CRUD()
        {
            e.user_account obj = new e.user_account()
            {
                user_id           = 0,
                user_name         = "owner",
                full_name         = "itstar",
                password          = "******",
                phone_no          = "098888888",
                entrypoint_user   = true,
                dashboard_user    = false,
                active            = true,
                point_admin_right = true,
                station_id        = 1,
                quarantine_user   = false,
                created_by        = "Admin",
                creation_date     = DateTime.Now,
                entrypoint_id     = 1,
                modified_by       = "owner",
                modified_date     = DateTime.Now,
                remark            = "testing"
            };

            //Create
            e.shared.ActionResult insert_result = d.user_account.Insert(obj).Result;

            //Read
            obj = d.user_account.Get(int.Parse(insert_result.Value.ToString())).Result;

            //Read all
            IEnumerable <e.user_account> objs = d.user_account.Get().Result;

            //Update
            obj.user_name = "testing update";
            e.shared.ActionResult update_result = d.user_account.Update(obj).Result;

            //Delete
            e.shared.ActionResult delete_result = d.user_account.Delete(int.Parse(insert_result.Value.ToString())).Result;
        }