コード例 #1
0
        public async Task SaveForm(InventoryEntity entity)
        {
            if (entity.Id.IsNullOrZero())
            {
                await entity.Create();

                await this.BaseRepository().Insert(entity);
            }
            else
            {
                await entity.Modify();

                await this.BaseRepository().Update(entity);
            }
        }
コード例 #2
0
        public string SubmitForm(InventoryEntity inventoryEntity, string id)
        {
            string _id;

            if (!string.IsNullOrEmpty(id))
            {
                inventoryEntity.Modify(id);
                service.Update(inventoryEntity);

                _id = id;

                new LogApp().WriteDbLog("修改产品:" + new ProductApp().GetNameByCode(inventoryEntity.ProductType), DbLogType.Update);
            }
            else
            {
                _id = inventoryEntity.Create();
                service.Insert(inventoryEntity);

                new LogApp().WriteDbLog("新增产品:" + new ProductApp().GetNameByCode(inventoryEntity.ProductType), DbLogType.Create);
            }

            return(_id);
        }