예제 #1
0
 public Volunteer Add(Volunteer volunteer)
 {
     volunteer.Id = _volunteers.Any() ? _volunteers.Max(v => v.Id) + 1 : 1;
     _volunteers.Add(volunteer);
     Save();
     return volunteer;
 }
예제 #2
0
 public IHttpActionResult Register(RegisterRequest register)
 {
     var volunteer = new Volunteer
     {
         FirstName = register.FirstName,
         LastName = register.LastName,
         Mobile = register.Mobile,
         Email = register.Email,
         PostCode = register.PostCode,
         PasswordHash = register.PasswordHash,
         Availability = false
     };
     var volunteerWithId = _volunteerRepository.Add(volunteer);
     return Ok(volunteerWithId);
 }