Advertisement
joaopaulofcc

Untitled

Nov 17th, 2021
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using Flunt.Notifications;
  2. using Flunt.Validations;
  3.  
  4. namespace MiniTodo.ViewModels
  5. {
  6.     public class CreateTodoViewModel : Notifiable<Notification>
  7.     {
  8.         public string Title { get; set; }
  9.  
  10.         public Todo MapTo()
  11.         {
  12.             AddNotifications(new Contract<Notification>()
  13.                 .Requires()
  14.                 .IsNotNull(Title, "Informe o título da tarefa")
  15.                 .IsGreaterThan(Title, 5, "O título deve conter mais de 5 caracteres"));
  16.  
  17.             return new Todo(Guid.NewGuid(), Title, false);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement