123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using Ant.Core.WebApi.Model;
- using Central.Control.WebApi.EFDbContext;
- using Central.Control.WebApi.Models;
- using Central.Control.WebApi.Service.Interface;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace Central.Control.WebApi.Service
- {
- /// <summary>
- ///
- /// </summary>
- public class ProductService: IProductService
- {
- private readonly IDbContext _dbContent;
- /// <summary>
- ///
- /// </summary>
- /// <param name="dbContent"></param>
- public ProductService(IDbContext dbContent)
- {
- _dbContent = dbContent;
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public ApiResult<string> Test()
- {
- //CentralControlContext _dbContent1 = new CentralControlContext();
- //var ss = _dbContent1.SYS_DEVICE.AsQueryable().Where(p => p.Id == "cb8b354c-b713-4dd7-9752-a6f3217004a0").ToList();
- //var ss1 = _dbContent1.Set<SYS_DEVICE>().FirstOrDefault(p => p.Id == "cb8b354c-b713-4dd7-9752-a6f3217004a0");
- // _dbContent1.SYS_DEVICE.
- // var qq = _dbContent1.SYS_DEVICE.SqlQuery("");
- var ww = _dbContent.Set<SYS_Device>().FirstOrDefault(p => p.Id == "cb8b354c-b713-4dd7-9752-a6f3217004a0");
- if (ww != null)
- {
- ww.Name = ww.Name + "1";
- }
- _dbContent.SaveChanges();
- return new ApiResult<string>("查库得到数据:" + ww?.Name ?? "nodata");
- }
- }
- }
|