public static Dal.Birth ToDalBirth(Dto.BirthDto b) { Dal.Birth en = new Dal.Birth(); en.BirthId = b.BirthId; en.UserId = b.UserId; en.BirthDateOfBaby = b.BirthDateOfBaby; en.BoyOrGirl = b.BoyOrGirl; en.NumOfBabies = b.NumOfBabies; return(en); }
public static int AddMother(Dto.MotherDto motherDto) { var user = new Dal.Users { UserId = motherDto.UserId, FirstName = motherDto.firstName, LastName = motherDto.lastName, Email = motherDto.email, Password = motherDto.password, Active = motherDto.Active, BirthDate = motherDto.BirthDate, Locality = motherDto.Locality, Address = motherDto.Address, NumOfHouse = motherDto.NumOfHouse, Phone = motherDto.Phone, RoleId = motherDto.RoleId }; //var userId = Dal.UserDal.AddUser(user); var mother = new Dal.Mother { UserId = user.UserId, Users = user, NumOfChildren = motherDto.NumOfChildren, }; //var nuser = Dal.UserDal.AddUser(converterEF.UsersConverters.ToDalUsers(motherDto.)); //var birth = Dal.BirthDal.AddBirth(converterEF.BirthConverters.ToDalBirth(motherDto.UserId)); var nBirth = new Dal.Birth { BirthId = motherDto.BirthId, UserId = motherDto.UserId, BirthDateOfBaby = motherDto.BirthDateOfBaby, BoyOrGirl = motherDto.BoyOrGirl, NumOfBabies = motherDto.NumOfBabies, }; var motherId = Dal.MotherDal.AddMother(mother, nBirth); return((int)motherId); }