public void UnitTestUpdateMemberRecords() { // Add reecord _memberrequest.AddNewMemberEntry( "Bill", "Blogs", "*****@*****.**", "0229230292", DateTime.Parse("1990-10-12"), "Active" ); // Retrieve record. Member member = _memberrequest.GetMemberEntry(1); int key = 0; if (member != null) { key = member.ID; } else { Assert.Fail("Cannot retrieve Member record"); } string valueToUpdate = "Bob"; // Update record. _memberrequest.EditMemberEntry( key, valueToUpdate, member.LastName, member.EmailAddress, member.ContactNumber, member.DateOfBirth, member.AccountStatus ); // Retrieve updated record. member = _memberrequest.GetMemberEntry(1); key = 0; if (member != null) { key = member.ID; } else { Assert.Fail("Cannot retrieve updated Member record"); } Assert.IsTrue(member.FirstName == valueToUpdate); }
public IActionResult Get(int id) { Member member = _memberrequest.GetMemberEntry(id); if (member != null) { return(new JsonResult(_objectmapper.Map <MemberViewModel>(member), DefaultJsonSettings)); } else { return(NotFound(new { Error = String.Format("Member ID {0} has not been found", id) })); } }