public async Task <string> SendLead(SendLeadto1CDTo lead) { var dto1CLead = new SendLeadto1CDTo(); dto1CLead = lead.Adapt <SendLeadto1CDTo>(mapper); if (dto1CLead.isValid == false) { throw new ArgumentException(String.Join(" | ", dto1CLead.GetValidateErrors())); } var result = await database.Persons.InviteTo1C(dto1CLead.Adapt <AddLeadDTO>(mapper)); if (result != "Студент зачислен") { throw new ArgumentException(); } return(String.IsNullOrEmpty(result) ? null : result); }
public void SendLead2() { var commonDTO = new SendLeadto1CDTo { ContractTitle = "ТстДГВор", //ContractGroup = "Тест", //ContractEducationStart = "2019-03-10".ToDateTime('-'), //ContractEducationEnd = "2019-03-13".ToDateTime('-').AddDays(10), //ContractExpire = "2019-03-20".ToDateTime('-').AddDays(180), ContractPrice = 8000, //DecreeTitle = "ТстПрикз", ProgramGuid = "3a660dca-9f7b-11e6-80e7-0cc47a4b75cc", UserGuid = "5bf0c9ee-8973-11e6-8102-10c37b94684b" }; var serviceDTO = commonDTO.Adapt <AddLeadDTO>(); var sdf = new UnitOfWork("Kloder", "Kaligula2"); // var sss = sdf.Persons.InviteTo1C(serviceDTO).Result; }
public void SendLeadto1CDTo_AddLeadDTO() { var commonDTO = new SendLeadto1CDTo { ProgramGuid = "7da38f8f-9f71-11e6-80e7-0cc47a4b75cc", // 3a660dca-9f7b-11e6-80e7-0cc47a4b75cc UserGuid = "cef55369-cd46-11e8-8103-0cc47a4b75cc", //5bf0c9ee-8973-11e6-8102-10c37b94684b ContractTitle = "ТстДГВор", ContractGroup = "Тест", ContractEducationStart = "2018-10-10".ToDateTime('-'), ContractEducationEnd = "2018-10-10".ToDateTime('-').AddDays(10), ContractExpire = "2018-10-10".ToDateTime('-').AddDays(180), ContractPrice = 8000, DecreeTitle = "ТстПрикз" }; var serviceDTO = commonDTO.Adapt <AddLeadDTO>(); Assert.AreEqual(serviceDTO.ProgramGuid, "7da38f8f-9f71-11e6-80e7-0cc47a4b75cc"); Assert.AreEqual(serviceDTO.ContractSubGroup, ""); Assert.AreEqual(serviceDTO.ContractEducationEnd, new DateTime(2018, 10, 20)); }