Skip to content

Instantly share code, notes, and snippets.

@AndyButland
Created September 26, 2016 08:57
Show Gist options
  • Save AndyButland/d56d2c46c69d8ab754e4079a0df9d5b9 to your computer and use it in GitHub Desktop.
Save AndyButland/d56d2c46c69d8ab754e4079a0df9d5b9 to your computer and use it in GitHub Desktop.
using System.ComponentModel.DataAnnotations;
public class Category
{
private Category()
{
}
public Category(string name)
{
SetName(name);
}
public int Id { get; set; }
[Required]
[StringLength(50)]
public string Name { get; private set; }
public void SetName(string name)
{
Name = name;
}
}
public class Task
{
private Task()
{
}
public Task(string description, Category category)
{
SetDetails(description, category);
}
public int Id { get; set; }
[Required]
[StringLength(500)]
public string Description { get; private set; }
public bool IsComplete { get; private set; }
[Required]
public Category Category { get; private set; }
public void SetDetails(string description, Category category)
{
Description = description;
Category = category;
}
public void MarkComplete()
{
IsComplete = true;
}
public void MarkIncomplete()
{
IsComplete = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment