Example #1
0
        public void InsertUnitRecord(UnitRecord record, unit ownerUnit)
        {
            using (var context = new Entities())
            {
                unit_record newRecord = new unit_record()
                {
                    unit = ownerUnit,
                    currentTime = record.CurrnetTime,
                    weight = record.Weight,
                    speed = record.Speed
                };
                context.unit_record.Add(newRecord);
                context.SaveChanges();

            }
        }
Example #2
0
        public unit InsertUnit(Guid systemId)
        {
            using (var context = new Entities())
            {
                unit existUnit = GetUnitByID(systemId);
                if (existUnit != null)
                    return existUnit;

                unit newUnit = new unit()
                {
                    systemId = systemId.ToString(),
                    created = DateTime.Now
                };

                context.unit.Add(newUnit);
                context.SaveChanges();

                return newUnit;
            }
        }