Add basic memento pattern

This commit is contained in:
Petrutiu Mihai
2016-06-23 20:43:37 +03:00
parent 0a130b0405
commit 37151a23c7
10 changed files with 210 additions and 28 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MememntoPattern.Employee
{
/// <summary>
/// Originator
/// </summary>
public class Employee
{
public string Name { get; set; }
public string Address { get; set; }
public List<String> Phones { get; set; }
public EmployeeMemento Save()
{
return new EmployeeMemento(Name, Address);
}
public void Revert(EmployeeMemento memento)
{
Name = memento.Name;
Address = memento.Address;
}
}
}