public async Task Add(OffRosterRequest offRosterRequest) { var offRosterToPost = new { Id = 0, offRosterRequest.ThreeLetterCode, StartDate = offRosterRequest.StartDate.ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture), EndDate = offRosterRequest.EndDate.GetValueOrDefault().ToString("yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture), offRosterRequest.IsOpenEnded, offRosterRequest.OffRosterCode, RequestingManager = "Dave", IsActioned = false }; _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-wwww-form-urlencoded")); await _httpClient.PostAsJsonAsync("http://localhost:65105/api/Manager/", offRosterToPost); }
public async Task Update(OffRosterRequest request) { var initialRequest = GetOffRosterRequestById(request.Id).Result; StringBuilder sb = new StringBuilder(); if (initialRequest.StartDate != request.StartDate) { sb.Append($"<p>Start Date changed from {initialRequest.StartDate.ToShortDateString()} to {request.StartDate.ToShortDateString()}</p>"); } if (initialRequest.EndDate != request.EndDate) { sb.Append($"<p>End Date changed from {initialRequest.EndDate.Value.ToShortDateString()} to {request.EndDate.Value.ToShortDateString()}</p>"); } if (initialRequest.OffRosterCode != request.OffRosterCode) { sb.Append($"<p>Off Roster code changed from {initialRequest.OffRosterCode} to {request.OffRosterCode}</p>"); } }