Skip to content

Instantly share code, notes, and snippets.

@gsedubun
gsedubun / Program.cs
Last active March 1, 2018 11:09
Demo implementation of IComparable<T>
class Program
{
private static WorkDay workday1 = new WorkDay { Day = 1, DayName = "Monday" };
private static WorkDay workday2 = new WorkDay { Day = 2, DayName = "Tuesday" };
private static WorkDay workday3 = new WorkDay { Day = 3, DayName = "Wednesday" };
private static WorkDay workday4 = new WorkDay { Day = 4, DayName = "Thursday" };
private static WorkDay workday5 = new WorkDay { Day = 5, DayName = "Friday" };
private static Shift shift1 = new Shift { Start = TimeSpan.Parse("08:00"), End = TimeSpan.Parse("12:00"), Name = "Shift 1" };
private static Shift shift2 = new Shift { Start = TimeSpan.Parse("12:00"), End = TimeSpan.Parse("16:00"), Name = "Shift 2" };
private static Shift shift3 = new Shift { Start = TimeSpan.Parse("16:00"), End = TimeSpan.Parse("20:00"), Name = "Shift 3" };
public class HomeController : Controller
{
[Authorize]
public IActionResult Index()
{
var roles = User.Identities;
return View(roles);
}
[Authorize(Roles="Penulis")]
public IActionResult About()
{
"ConnectionStrings":{
"DefaultConnection" :"server=.\\sqlexpress; database=belajarDb;user id=sa;password=[password]"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using belajarnetcoremvc.Models;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace belajarnetcoremvc.Models
{
public class belajarDbContext :DbContext
{
public belajarDbContext(DbContextOptions options) : base(options)
{
}
public class BPJSRegisterationViewModel
{
public string NoBPJS { get; set; }
public string NamaPeserta { get; set; }
public string ValidFrom { get; set; }
}