Skip to content

Instantly share code, notes, and snippets.

{
"_id": "Tournament",
"Name": "Tournament",
"Records": [
{
"_id": "0329201309:57:17.231",
"Date": {
"$date": "2013-03-23T14:55:25.856Z"
},
"Note": "0-2 Gi & 0-2 NoGi at Sasquatch Open"
public class User
{
public string Email {get; set;}
public string FirstName {get; set;}
public string LastName {get; set;}
public string Password {get; set;}
}
public class UserLogic
{
public class User
{
public string Email {get; set;}
public string FirstName {get; set;}
public string LastName {get; set;}
public string Password {get; set;}
public void User()
{
}
public void Create(User user)
{
if(string.IsNullOrWhiteSpace(user.Email))
throw new InvalidEmailException();
if(!new Regex("^[A-Za-z]\w{6,}[A-Za-z]$").IsMatch(user.Password))
throw new InvalidPasswordException();
if(string.IsNullOrWhiteSpace(user.FirstName) || string.IsNullOrWhiteSpace(user.LastName))
throw new InvalidNameException();
public class User
{
public string Email {get; set;}
public string FirstName {get; set;}
public string LastName {get; set;}
public string Password {get; set;}
public int Id {get; set;]
public void Validate(bool isUpdate = false)
{
public class UserController : Controller
{
[HttpPost]
public ActionResult Create(string email, string password, string firstName, string lastName)
{
new UserLogic().Create(email, password, firstName, lastName);
return View("UserCreated");
}
public class UserController : Controller
{
[HttpPost]
public ActionResult Create(string email, string password, string firstName, string lastName)
{
new UserLogic().Create(email, password, firstName, lastName);
return View("UserCreated");
}
}
public class UserController : Controller
{
[HttpPost]
public ActionResult Create(string email, string password, string firstName, string lastName)
{
if(string.IsNullOrWhiteSpace(email))
throw new InvalidEmailException();
if(!new Regex("^[A-Za-z]\w{6,}[A-Za-z]$").IsMatch(password))
throw new InvalidPasswordException();
@taylonr
taylonr / gist:3033763
Created July 2, 2012 15:22
Bad String Loop
string file = null;
while ((line = sr.ReadLine()) != null)
{
file += line;
}
window.SetText(file);
@taylonr
taylonr / gist:3026036
Created June 30, 2012 23:35
ICarStart
public interface ICar
{
void Start();
}