demo20230512/Areas/Lca/Controllers/HomeController.cs
2023-05-12 10:20:28 +08:00

45 lines
1.2 KiB
C#

using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Weee.Controllers;
using Weee.DAL;
using Weee.Models;
using Weee.Service;
using Weee.ViewModels.Lca;
using CScommon;
namespace Weee.Areas.Lca.Controllers
{
public class HomeController : QcarbonControllerBase
{
private UserService userService;
public HomeController(WeeeDataContext d, UserManager<User> m)
: base(d)
{
userService = new UserService(d, m);
}
// GET: Lca/Home
public ActionResult Index()
{
//var qry = (from a in uow.LCArepository.Get()
// select a).AsQueryable();
LcaIndexViewModel viewModel = new LcaIndexViewModel();
var currentId = User.Identity.GetUserId();
var qry = userService.GetByMyCompany(currentId);
string json = JsonUtl.fromT(qry);
viewModel.users =JsonUtl.toT<List<UserViewModel>>(json);
return View(viewModel);
}
[HttpPost]
public ActionResult Index(LcaIndexViewModel viewModel)
{
return View(viewModel);
}
}
}