public UserAddress CreateUserAddress(UserAddress userAddress)
        {
            db.UserAddresses.Add(userAddress);
            db.SaveChanges();

            return userAddress;
        }
Esempio n. 2
0
        public UserAddress Create(UserAddress oUserAddress)
        {
            if (oUserAddress != null)
            {
                return oUserAddressRepo.CreateUserAddress(oUserAddress);
            }

            return null;
        }
        public void UpdateUserAddress(int id, UserAddress userAddress)
        {
            db.Entry(userAddress).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Converts this instance of <see cref="UserAddressDTO"/> to an instance of <see cref="UserAddress"/>.
        /// </summary>
        /// <param name="dto"><see cref="UserAddressDTO"/> to convert.</param>
        public static UserAddress ToEntity(this UserAddressDTO dto)
        {
            if (dto == null) return null;

            var entity = new UserAddress();

            entity.UserAddressID = dto.UserAddressID;
            entity.UserID = dto.UserID;
            entity.AddressID = dto.AddressID;
            entity.IsPrimary = dto.IsPrimary;

            dto.OnEntity(entity);

            return entity;
        }
Esempio n. 5
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="UserAddress"/> converted from <see cref="UserAddressDTO"/>.</param>
 static partial void OnEntity(this UserAddressDTO dto, UserAddress entity);