public async Task <int> CreateAdvisor(AdvisorDTO Model) { var response = await httpClient.PostAsJsonAsync(_ContractOption.AdvisorEndpoint.CreateAdvisor, Model); var apiResult = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <int>(apiResult); return(result); }
public async Task <int> UpdateAdvisor(string id, AdvisorDTO Model) { var response = await httpClient.PutAsJsonAsync(string.Format(_ContractOption.AdvisorEndpoint.UpdateAdvisor, id), Model); var apiResult = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <int>(apiResult); return(result); }
private async Task <string> SeedMGAData() { var guid = System.Guid.NewGuid(); var advisor = new AdvisorDTO() { AdvisorId = guid.ToString(), Address = "Toronto", FirstName = "Advisor X1", LastName = "X1", PhoneNumber = "444-444-4444" }; await _seedmanager.Create(_mapper.Map <AdvisorEntity>(advisor)); return(guid.ToString()); }
public async Task UpdateAdvisor(AdvisorDTO advisorUpdated) { var update = Builders <Advisor> .Update .Set(advisor => advisor.Name, advisorUpdated.Name) .Set(advisor => advisor.Profession, advisorUpdated.Profession) .Set(advisor => advisor.Education, advisorUpdated.Education) .Set(advisor => advisor.Specialization, advisorUpdated.Specialization) .Set(advisor => advisor.Comment, advisorUpdated.Comment) .Set(advisor => advisor.LastUpdate, DateTime.Now); await _mongoRepository.UpdateOneAsync(advisor => advisor.Id == advisorUpdated.Id, update); }
public async Task AddAdvisor(AdvisorDTO advisorInsert) { Advisor advisor = new Advisor() { Name = advisorInsert.Name, Profession = advisorInsert.Profession, Education = advisorInsert.Education, Specialization = advisorInsert.Specialization, Comment = advisorInsert.Comment, }; await _mongoRepository.InsertOneAsync(advisor); }
public async Task <IActionResult> SaveForm(AdvisorDTO advisorModel) { int ret = -1; if (string.IsNullOrEmpty(advisorModel.AdvisorId)) { ret = await _contractClient.CreateAdvisor(advisorModel); } else { ret = await _contractClient.UpdateAdvisor(advisorModel.AdvisorId, advisorModel); } return(Json(ret)); }
public async Task Test_AddedNewMGA() { var guid = System.Guid.NewGuid(); var advisor = new AdvisorDTO() { AdvisorId = guid.ToString(), Address = "Toronto", FirstName = "Advisor X1", LastName = "X1", PhoneNumber = "444-444-4444" }; int ret = await _manager.Create(_mapper.Map <AdvisorEntity>(advisor)); Assert.AreEqual(1, ret); var newrec = await _manager.GetById(guid.ToString()); Assert.AreEqual(advisor.AdvisorId, newrec.AdvisorId.ToString()); Assert.AreEqual(1, _manager.GetAll().Result.Count()); }
public async Task Test_UpdateMGA() { var guid = await SeedMGAData(); var advisor = new AdvisorDTO() { AdvisorId = guid.ToString(), Address = "Toronto", FirstName = "Advisor X2", LastName = "X2", PhoneNumber = "444-444-4444" }; int ret = await _manager.Update(_mapper.Map <AdvisorEntity>(advisor), guid); Assert.AreEqual(1, ret); var newrec = await _manager.GetById(guid.ToString()); Assert.AreEqual(advisor.AdvisorId, newrec.AdvisorId.ToString()); Assert.AreEqual(advisor.FirstName, newrec.FirstName); Assert.AreEqual(advisor.LastName, newrec.LastName); }
public async Task UpdateAdvisor(AdvisorDTO advisorUpdated) { await _advisorRepository.UpdateAdvisor(advisorUpdated); }
public async Task RemoveAdvisor(AdvisorDTO advisorRemoved) { await _advisorRepository.RemoveAdvisor(advisorRemoved); }
public async Task AddAdvisor(AdvisorDTO advisor) { await _advisorRepository.AddAdvisor(advisor); }
public async Task <int> Update([FromRoute] string id, [FromBody] AdvisorDTO advisor) { return(await _advisorManager.Update(_mapper.Map <AdvisorEntity>(advisor), id)); }
public async Task <int> Create([FromBody] AdvisorDTO advisor) { return(await _advisorManager.Create(_mapper.Map <AdvisorEntity>(advisor))); }
public async Task <IActionResult> UpdateAdvisor(AdvisorDTO advisorDTO) { await _advisorService.UpdateAdvisor(advisorDTO); return(Ok(new { StatusCode = ReturnStatusCode.Ok })); }
public async Task <OkResult> RemoveAdvisor(AdvisorDTO advisorDTO) { await _advisorService.RemoveAdvisor(advisorDTO); return(Ok()); }
public async Task RemoveAdvisor(AdvisorDTO advisorRemoved) { await _mongoRepository.DeleteOneAsync( advisor => advisor.Id == advisorRemoved.Id); }