public static UserCustomerInfo ToDtoObject(this Trex.Server.Core.Model.UserCustomerInfo customerInfo) { var dtoUserCustomerInfo = new UserCustomerInfo(); dtoUserCustomerInfo.CustomerId = customerInfo.CustomerId; dtoUserCustomerInfo.UserId = customerInfo.UserId; dtoUserCustomerInfo.PricePrHour = customerInfo.PricePrHour; return(dtoUserCustomerInfo); }
public void DeleteCustomerInfo(UserCustomerInfo customerInfo) { var session = GetSession(); var queryString = "delete from UserCustomerInfo where UserId = :userId and CustomerId = :customerId"; var query = session.CreateQuery(queryString); query.SetInt32("userId", customerInfo.UserId); query.SetInt32("customerId", customerInfo.CustomerId); query.ExecuteUpdate(); }
public UserCustomerInfo Create(User user, Customer customer, double pricePrHour) { if (user == null) { throw new ParameterNullOrEmptyException("User cannot be null"); } if (customer == null) { throw new ParameterNullOrEmptyException("Customer cannot be null"); } var userCustomerInfo = new UserCustomerInfo(user, customer, pricePrHour); return(userCustomerInfo); }