public ConsolidatedUserInformationResponseModel CreateConsolidatedUser([FromBody] JObject jmodel) { var Model = new ConsolidatedUserInformationInputModel() { UserAccount = jmodel["user"].ToObject <UserAccountModel>(), UserAddress = jmodel["address"].ToObject <UserAddressModel>(), ContactInfo = jmodel["contactInfo"].ToObject <ContactInfoModel>(), Interests = jmodel["interests"].ToObject <List <InterestModel> >() }; Model.UserAccount = UserAccountService.CreateUserAccount(Model.UserAccount); Model.UserAddress = AddressService.CreateUserAddress(Model.UserAddress); Model.ContactInfo.UserAccountId = Model.UserAccount.Id; Model.ContactInfo.UserAddressId = Model.UserAddress.Id; Model.ContactInfo = ContactInfoService.CreateUserContactInfo(Model.ContactInfo); if (Model.Interests != null) { foreach (var Interest in Model.Interests) { var NewMapping = new InterestUserMapModel { UserAccountId = Model.UserAccount.Id, InterestId = Interest.Id }; InterestService.CreateInterestUserMap(NewMapping); } } Model.Interests = InterestService.GetUserInterests(Model.UserAccount.Id); return(TransformHelpers.UserInputModelToUserResponseModel(Model)); }
public static InterestUserMapModel CreateInterestUserMap(InterestUserMapModel mapModel) { using (var _context = new bbbsDbContext()) { var newMap = _context.Add(new InterestUserMap { InterestId = mapModel.InterestId, UserAccountId = mapModel.UserAccountId }); _context.SaveChanges(); mapModel.Id = newMap.Entity.Id; return(mapModel); } }
public InterestUserMapModel CreateInterestUserMap(InterestUserMapModel mapModel) { return(InterestService.CreateInterestUserMap(mapModel)); }
internal static InterestUserMapModel CreateInterestUserMap(InterestUserMapModel mapModel) { return(InterestRepository.CreateInterestUserMap(mapModel)); }