This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web.Mvc; | |
using ExemploDeDataPreenchida.Models; | |
namespace ExemploDeDataPreenchida.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
// | |
// GET: /Home/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul data-bind="template: { name: 'choiceTmpl', foreach: choices, templateOptions: { selections: selectedChoices } }"></ul> | |
<script id="choiceTmpl" type="text/html"> | |
<li> | |
<input type="checkbox" data-bind="attr: { value: $data.id }, checked: $item.selections" /> | |
<span data-bind="text: $data.descricao"></span> | |
</li> | |
</script> | |
<hr /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul data-bind="foreach: items"> | |
<li> | |
<input type="checkbox" data-bind="attr: { value: id }, checked: $root.checked" /> | |
<span data-bind="text: descricao"></span> | |
</li> | |
</ul> | |
<hr/> | |
<div data-bind="text: ko.toJSON($root)"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Selecionando objetos distintos usando Linq | |
//Agrupando com uma propriedade | |
List<Pessoa> pessoasDistintas = todasAsPessoas | |
.GroupBy(p => p.Id) | |
.Select(g => g.First()) | |
.ToList(); | |
//Agrupando com varias propriedades | |
List<Pessoa> pessoasDistintas = todasAsPessoas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace MvcApplication6.Controllers | |
{ | |
public class HomeController : Controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace TimeZone | |
{ | |
class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Console.WriteLine("Data/Hora atual UTC : {0}", DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")); | |
Console.WriteLine("Data/Hora (UTC -4 Rondônia) : {0}", DateTime.UtcNow.AddHours(-4).ToString("dd/MM/yyyy HH:mm:ss")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class SeoUrl | |
{ | |
public static string Sanitize(string input) | |
{ | |
if (string.IsNullOrEmpty(input)) | |
{ | |
return input; | |
} | |
var normalizedString = FoldDiacriticals(input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using TISelvagem.Aplicacao; | |
using TISelvagem.Dominio; | |
namespace TISelvagem.UI.Web.Controllers | |
{ | |
public class AlunoController : Controller | |
{ | |
// | |
// GET: /Aluno/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let somar (n1:int) (n2:int) = n1 + n2 | |
let subtrair = fun n1 n2 -> n1 - n2 | |
let multiplicar n1 n2 = n1 * n2 | |
module Calculadora = | |
let somar n1 n2 = n1 + n2 | |
let subtrair = fun n1 n2 -> n1 - n2 | |
let rec fatorial n = | |
if n = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTime baseDate = DateTime.Today; | |
var today = baseDate; | |
var yesterday = baseDate.AddDays(-1); | |
var thisWeekStart = baseDate.AddDays(-(int)baseDate.DayOfWeek); | |
var thisWeekEnd = thisWeekStart.AddDays(7).AddSeconds(-1); | |
var lastWeekStart = thisWeekStart.AddDays(-7); | |
var lastWeekEnd = thisWeekStart.AddSeconds(-1); | |
var thisMonthStart = baseDate.AddDays(1 - baseDate.Day); | |
var thisMonthEnd = thisMonthStart.AddMonths(1).AddSeconds(-1); |