Example #1
0
        public async Task <IHttpActionResult> AddMonGroup([FromBody] MonGroup model)
        {
            var result = context.MonGroup.Add(model);

            context.SaveChanges();
            return(Ok(result));
        }
Example #2
0
        void _ReadMonGroups(DGObjects objs, string tableNameSQL,
                            string conditionSQL, string orderSQL)
        {
            DataTable table = objs.rawDataSet.Tables[0];

            foreach (DataRow row in table.Rows)
            {
                if (IsDbNull(row, "ID") || IsDbNull(row, "Name"))
                {
                    continue;
                }

                MonGroup obj = new MonGroup(row);
                obj.id          = ReadInt(row, "ID").Value;
                obj.name        = ReadString(row, "Name");
                obj.fullName    = ReadString(row, "FullName");
                obj.description = ReadString(row, "Description");
                obj.shape       = ReadShape(row);

                obj.groupShape = ReadString(row, "groupShape");
                string str = ReadString(row, "monPntNames");
                if (str != null)
                {
                    obj.monPntNames = str.Split(_separator);
                }

                objs[obj.key] = obj;
            }
        }
Example #3
0
        public async Task <IHttpActionResult> RemoveMonGroup(int id)
        {
            MonGroup obj = context.Set <MonGroup>().Find(id);

            context.Entry(obj).State = System.Data.Entity.EntityState.Deleted;
            context.SaveChanges();
            return(Ok(obj));
        }
Example #4
0
        public async Task <IHttpActionResult> ModifyMonGroup([FromBody] MonGroup model)
        {
            MonGroup obj = context.Set <MonGroup>().Find((model.ID));

            UpdateModelHelp.Update(model, obj);
            context.Entry(obj).State = System.Data.Entity.EntityState.Modified;
            context.SaveChanges();
            return(Ok(obj));
        }
        void _ReadMonGroups(DGObjects objs, string tableNameSQL,
            string conditionSQL, string orderSQL)
        {
            DataTable table = objs.rawDataSet.Tables[0];
            foreach (DataRow row in table.Rows)
            {
                if (IsDbNull(row, "ID") || IsDbNull(row, "Name"))
                    continue;

                MonGroup obj = new MonGroup(row);
                obj.id = ReadInt(row, "ID").Value;
                obj.name = ReadString(row, "Name");
                obj.fullName = ReadString(row, "FullName");
                obj.description = ReadString(row, "Description");
                obj.shape = ReadShape(row);

                obj.groupShape = ReadString(row, "groupShape");
                string str = ReadString(row, "monPntNames");
                if (str != null)
                    obj.monPntNames = str.Split(_separator);

                objs[obj.key] = obj;
            }
        }