using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using APT.BaseData.Domain.Entities.FM;
using APT.Infrastructure.EF;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace APT.PF.WebApi.Controllers.Api
{
    [Route("api/[controller]")]
    [ApiController]
    public class ValuesController : Controller
    {
        [HttpGet]
        public ActionResult<IEnumerable<string>> Get()
        {
            return new string[] { "RELEASE", "Version2020-04-1:2048" };
        }

        // GET api/values/5
        //[Authorize]
        [HttpGet("GetValues")]
        public ActionResult<string> GetValues()
        {
            //EfDbContext dbContext =
            //    new EfDbContext("User ID=postgres;Password=123456;Host=192.168.2.98;Port=5432;Database=opt_energy6;CommandTimeout=1024;");
            //var obj = dbContext.GetEntity<T_FM_BASE_CONFIG>(null, null);
            //if (obj != null)
            //    obj.NAME = "123";
            //dbContext.SaveChanges();
            //obj = dbContext.GetEntity<T_FM_BASE_CONFIG>(null, null);
            //EfDbContext dbContext1 =
            //   new EfDbContext("User ID=postgres;Password=123456;Host=192.168.2.98;Port=5432;Database=opt_energy;CommandTimeout=1024;");
            //var obj1 = dbContext1.GetEntity<T_FM_BASE_CONFIG>(null, null);
            return "value";
        }

        // POST api/values
        [HttpPost]
        public void Post([FromBody] string value)
        {
        }

        // PUT api/values/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody] string value)
        {
        }

        // DELETE api/values/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}