public void EditAttach(string testCode, string sexesString) { string[] sexCods = sexesString.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); DtoTestSexAllowed[] dtoTestSexAlloweds = OrderService.SearchTestSexAllowedsByTest(testCode); foreach (var testSexAllowed in dtoTestSexAlloweds) { OrderService.DeleteTestSexAllowed(testSexAllowed); } foreach (var sexCode in sexCods) { int sexId = new SexServiceClient().GetSexByCode(sexCode).Id; var dtoTestSexAllowed = new DtoTestSexAllowed() { Test = new Medicine.Clinic.Client.Model.OrderService.DtoTest { Id = TestService.GetTestByCode(testCode).Id }, Sex = new OrderService.DtoSex { Id = sexId } }; OrderService.AddTestSexAllowed(dtoTestSexAllowed); } }
public void SaveAttached(string testCode, string sexesString) { string[] sexCods = sexesString.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); int testId = TestService.GetTestByCode(testCode).Id; foreach (var sexItem in sexCods) { int sexId = new SexServiceClient().GetSexByCode(sexItem.ToString()).Id; var dtoTestSexAllowed = new DtoTestSexAllowed() { Test = new DtoTest1 { Id = testId }, Sex = new DtoSex1 { Id = sexId } }; OrderService.AddTestSexAllowed(dtoTestSexAllowed); } }