コード例 #1
0
        /// <summary>
        /// Saves a newly created physiology record
        /// </summary>
        /// <param name="physiology">The physiology model</param>
        public void SaveCreate(PhysiologyDto physiology)
        {
            var phyDomain = PhysiologyToDomain(physiology);

            UserServices userService = new UserServices();
            UserDto      dto         = userService.GetUser();

            phyDomain.AgeSnapshot = userService.GetTimespanSinceBirthdate(dto.BirthDate);

            var domain = new User_Phy
            {
                UserId     = physiology.UserId,
                Physiology = phyDomain
            };

            db.User_Phy.Add(domain);
            db.SaveChanges();
        }