예제 #1
0
        private async Task UpdateConnetionInfo(Mst_ConnectionInfo view)
        {
            using (var db = new MyContext())
            {
                var result = GetConnectionInfoSingleOrDefault();

                result.Ip_Address = view.Ip_Address;
                result.Port       = view.Port;

                await db.SaveChangesAsync();
            }
        }
예제 #2
0
        private async Task InsertConnetionInfo(Mst_ConnectionInfo view)
        {
            using (var db = new MyContext())
            {
                db.Mst_ConnectionInfo.Add(new Mst_ConnectionInfo
                {
                    Ip_Address = view.Ip_Address,
                    Port       = view.Port
                });

                await db.SaveChangesAsync();
            }
        }
예제 #3
0
        public async Task <bool> InsertOrUpdateAsync(Mst_ConnectionInfo view)
        {
            if (view.Ip_Address == null || view.Ip_Address == "" || view.Port == 0)
            {
                return(false);
            }

            if (IsCountZero())
            {
                await InsertConnetionInfo(view);
            }
            else
            {
                await UpdateConnetionInfo(view);
            }

            return(true);
        }