Exemplo n.º 1
0
        public IActionResult Index()
        {
            var userName = new IndexViewModel();

            if (_middleware.GetUser() == null)
            {
                userName.Name = "Посетитель";
            }
            else
            {
                userName.Name = _middleware.GetUser().Username;
            }

            return(View(userName));
        }
Exemplo n.º 2
0
    public IActionResult Create(CreateWorkViewModel viewModel)
    {
        var work = new WorkDTO
        {
            Title       = viewModel.Title,
            Description = viewModel.Description,
            Cost        = viewModel.Cost,
            UserId      = _middleware.GetUser().Id
        };

        _service.CreateWork(work);
        return(RedirectToAction("Index", "Home"));
    }