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 IEnumerable<IList<T>> BatchAggregate<T>(this IEnumerable<T> source, int batchSize) | |
{ | |
var enumerator = source.GetEnumerator(); | |
for (int page = 0; enumerator.MoveNext(); page = page + batchSize) | |
{ | |
var list = source | |
.Skip(page) | |
.Take(batchSize) | |
.ToList(); |
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 class MatriculaViewModel | |
{ | |
public SelectList Turmas { get; set; } | |
public int? TurmaSelecionada { get; set; } | |
public DateTime DataDaMatricula { get; set; } | |
[Required] | |
public string NomeDoAluno { get; set; } |
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.ComponentModel.DataAnnotations; | |
namespace AppWeb.ViewModels | |
{ | |
public class LoginViewModel | |
{ | |
[Required(ErrorMessage = "Login é um campo obrigatório")] | |
public string Login { get; set; } | |
[Required(ErrorMessage = "Senha é um campo obrigatório")] |
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.ComponentModel.DataAnnotations; | |
namespace AppWeb.ViewModels | |
{ | |
public class LoginViewModel | |
{ | |
[Required(ErrorMessage = "Login é um campo obrigatório")] | |
[StringLength(30, ErrorMessage="O login deve ter no máximo 30 caracteres")] | |
public string Login { get; set; } |
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.ComponentModel.DataAnnotations; | |
using System.Linq; | |
namespace AppWeb.ViewModels | |
{ | |
public class LoginViewModel | |
{ | |
[Required(ErrorMessage = "Login é um campo obrigatório")] |
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.ComponentModel; | |
using System.ComponentModel.DataAnnotations; | |
namespace AppWeb.Attribute | |
{ | |
[AttributeUsage(AttributeTargets.Class)] | |
public class ComparaPropriedadesAttribute : ValidationAttribute | |
{ | |
public string PrimeiroCampo { get; private set; } |
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
[ComparaPropriedades("Senha", "ConfirmacaoDaSenha", ErrorMessage="A confirmação da senha não bate com a senha original")] | |
public class CadastroDeLoginViewModel | |
{ | |
public string Login { get; set; } | |
public string Senha { get; set; } | |
public string ConfirmacaoDaSenha { get; set; } | |
} |
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 class AgendamentoDePagamentoViewModel | |
{ | |
public AgendamentoDePagamentoViewModel() {} // construtor vazio necessario para para o modelbinder | |
public AgendamentoDePagamentoViewModel(IEnumerable<Conta> contas) | |
{ | |
Contas = MontarSelectListDeContas(contas); | |
} | |
public SelectList Contas { get; set; } |
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 ActionResult AgendarPagamento() | |
{ | |
var contas = recuperarContasAPagar(); | |
var viewModel = new AgendamentoDePagamentoViewModel(contas); | |
return View(viewModel); | |
} |
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
[HttpPost] | |
public ActionResult AgendarPagamento(AgendamentoDePagamentoViewModel viewModel) | |
{ | |
if (!ModelState.IsValid) | |
{ | |
var contas = recuperarContasAPagar(); | |
viewModel.MontarSelectListDeContas(contas); | |
return View(viewModel); | |
} |
OlderNewer