Skip to content

Instantly share code, notes, and snippets.

View tusmester's full-sized avatar
🎯
Cleaning up stuff and preparing for the future.

Miklós Tóth tusmester

🎯
Cleaning up stuff and preparing for the future.
View GitHub Profile
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using SenseNet.ContentRepository;
using SenseNet.ContentRepository.Storage.Security;
using SenseNet.Search;
namespace SnWebApplication.Models
{
@tusmester
tusmester / post.snmvc.views.index.cshtml
Created February 8, 2018 12:46
#sn #mvc #view #index
@{
ViewBag.Title = "Dashboard";
}
@model SnWebApplication.Models.DashboardViewModel
<h2>@ViewBag.Title</h2>
<h3>@ViewBag.Message</h3>
<div class="row">
@tusmester
tusmester / post.snmvc.dashboardcontroller.cs
Created February 8, 2018 12:49
#sn #mvc #controller #dashboard
using System.Web.Mvc;
using SnWebApplication.Models;
namespace SnWebApplication.Controllers
{
public class DashboardController : Controller
{
public string SitePath { get; } = "/Root/Sites/Default_Site";
public string TaskListName { get; } = "Tasks";
public string TaskListPath => SitePath + "/" + TaskListName;
@tusmester
tusmester / post.snmvc.dashboardviewmodel.cs
Created February 8, 2018 12:51
#sn #mvc #viewmodel #dashboard
using SenseNet.ContentRepository;
using SenseNet.Search;
using System.Collections.Generic;
using System.Linq;
namespace SnWebApplication.Models
{
public class DashboardViewModel
{
public IEnumerable<TaskViewModel> MyTasks => Content.All
@tusmester
tusmester / post.snmvc.taskviewmodel.cs
Created February 8, 2018 12:52
#sn #mvc #viewmodel #task
using System;
using System.ComponentModel.DataAnnotations;
using SenseNet.ContentRepository;
using SenseNet.ContentRepository.Storage.Security;
namespace SnWebApplication.Models
{
public class TaskViewModel
{
public readonly Task Task;
@tusmester
tusmester / post.snmvc.auth.logoff.cs
Created February 8, 2018 12:53
#sn #mvc #authentication
public ActionResult LogOff()
{
SenseNet.Portal.Virtualization.AuthenticationHelper.Logout();
return RedirectToLocal("/");
}
@tusmester
tusmester / post.snmvc.views.login.cshtml
Created February 8, 2018 12:56
#sn #mvc #view #login
@using Microsoft.AspNet.Identity
@if (Request.IsAuthenticated)
{
using (Html.BeginRouteForm("Default", new
{
ReturnUrl = ViewBag.ReturnUrl,
controller = "Account",
action = "LogOff"
}, FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
{
@tusmester
tusmester / post.snmvc.views.create.cshtml
Created February 8, 2018 12:58
#sn #mvc #view #create
@{
ViewBag.Title = "Create task";
}
@using SnWebApplication.Models
@model TaskViewModel
<h2>@ViewBag.Title</h2>
<div class="row">
<div class="col-md-8">
@tusmester
tusmester / post.snmvc.views.deletetask.cshtml
Created February 8, 2018 13:00
#sn #mvc #view #deletetask
@{
ViewBag.Title = "Delete task";
ViewBag.Message = "Are you sure you want to delete this task?";
}
@using SnWebApplication.Models
@model TaskViewModel
<h2>@ViewBag.Title</h2>
<h3>@ViewBag.Message</h3>
@tusmester
tusmester / post.snmvc.dashboardcontroller2.cs
Created February 8, 2018 13:01
#sn #mvc #controller #dashboard
using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using SNCR = SenseNet.ContentRepository;
using SenseNet.ContentRepository.Storage;
using SenseNet.ContentRepository.Storage.Security;
using SnWebApplication.Models;
namespace SnWebApplication.Controllers