public async Task <IActionResult> AddInvitationalTraveler([FromBody] InvitationalTravelerResource invitationalTravelerResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var invitationalTraveler = _mapper.Map <InvitationalTravelerResource, InvitationalTraveler>(invitationalTravelerResource); invitationalTraveler.Status = Status.Active; invitationalTraveler.StatusUpdateUserNEDId = "system"; invitationalTraveler.StatusUpdateDateTime = DateTime.UtcNow; invitationalTraveler.CreateUserNEDId = "system"; invitationalTraveler.CreateDateTime = DateTime.UtcNow; _unitOfWork.Organization.AddInvitationalTraveler(invitationalTraveler); await _unitOfWork.Complete(); return(await GetInvitationalTraveler(invitationalTraveler.InvitationalTravelerId)); }
public async Task <IActionResult> UpdateInvitationalTraveler(int id, [FromBody] InvitationalTravelerResource invitationalTravelerResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var invitationalTraveler = await _unitOfWork.Organization.GetInvitationalTraveler(id); if (invitationalTraveler == null) { return(NotFound()); } _mapper.Map <InvitationalTravelerResource, InvitationalTraveler>(invitationalTravelerResource, invitationalTraveler); invitationalTraveler.LastUpdateUserNEDId = "system"; invitationalTraveler.LastUpdateDateTime = DateTime.UtcNow; await _unitOfWork.Complete(); return(await GetInvitationalTraveler(invitationalTraveler.InvitationalTravelerId)); }