Skip to content

Instantly share code, notes, and snippets.

using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Peliculas.Core.Dtos
{
public class PeliculaDtoIn
{
public string Encodedkey { get; set; } = Guid.NewGuid().ToString();
[Required(ErrorMessage = "El título es obligatorio")]
@vmartinez1984
vmartinez1984 / PeliculaMapeador.cs
Last active October 6, 2025 17:00
MapeadooooorDelDrChunga
public static class PeliculaMapeador
{
public static PeliculaDto ToDto(this PeliculaEntidad entidad) => entidad is null ? null : new PeliculaDto
{
Encodedkey = entidad.Encodedkey,
FechaDeRegistro = entidad.FechaDeRegistro,
Id = entidad.Id,
Sinopsis = entidad.Sinopsis,
Titulo = entidad.Titulo,
Trailer = entidad.Trailer
@vmartinez1984
vmartinez1984 / Pelicula.cs
Last active September 20, 2025 02:21
Clase Pelicula
public class PeliculaEntidad
{
//[JsonIgnore]
public int Id { get; set; }
[Required]
[MaxLength(50)]
public string Titulo { get; set; }
[Required]
/// Controlador de un CRUD de Tareas
public class HomeController : Controller
{
/// Acceso a las reglas de negocio, provider, factory o service
private readonly IMediator _mediator;
/// Inyecccion del provider
public HomeController(IMediator mediator)
{
_logger = logger;
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HolaMundoMvvm.MainPage">
<StackLayout Padding="30">
<Label Text="Nombre:" />
<!-- Se hace el enlace miedante la palabra clave Bindig a la propiedad del Persona.Nombre del ViewModel -->
<Entry Text="{Binding Persona.Nombre}" />
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Input;
namespace HolaMundoMvvm
{
/// <summary>
/// Clase que se encarga de enlazar (Binding) el modelo (PersonaModel) con la vista (MainPage.xml)
/// </summary>
internal class PersonaViewModel: INotifyPropertyChanged
namespace HolaMundoMvvm
{
internal class PersonaModel
{
public string Nombre { get; set; }
public int Edad { get; set; }
}
}