aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModelLocator.cs
blob: c06ae05e712cbf28f45d609af71163bdcab77e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.MachineStudio.Sites.ViewModels;

namespace Tango.MachineStudio.Sites
{
    public static class ViewModelLocator
    {
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        static ViewModelLocator()
        {
            TangoIOC.Default.Register<MainViewVM>();
        }

        public static MainViewVM MainViewVM
        {
            get
            {
                return TangoIOC.Default.GetInstance<MainViewVM>();
            }
        }
    }
}
pan class="w"> } public ActionResult Login() { if (HttpContext.User.Identity.IsAuthenticated) { return RedirectToAction("Index", "Downloads", null); } return View(); } [HttpPost] public ActionResult Login(AccountLogin request) { var authResult = _ad_manager.ValidateUserCredentials(request.Email, request.Password); if (!_ad_manager.CanUserAccessCurrentEnvironment(request.Email)) { throw new AuthenticationException($"You do not have permissions to access the {MachineServiceConfig.DEPLOYMENT_SLOT.ToDescription()} environment."); } FormsAuthentication.SetAuthCookie(request.Email, true); return new HttpStatusCodeResult(HttpStatusCode.OK); } [Authorize] public ActionResult Logout() { FormsAuthentication.SignOut(); return Login(); } } }