public async Task <RetailerLocationViewModel> GetRetailerLocation(int retailerLocationId) { RetailerLocationViewModel result = null; string cmd = $@"SELECT * FROM `retailer_location` rl LEFT JOIN `address` a ON a.id = rl.address_id AND a.is_used = 1 AND a.is_deleted = 0 LEFT JOIN `contact` c ON c.id = rl.contact_id AND c.is_used = 1 AND c.is_deleted = 0 WHERE rl.id = {retailerLocationId} and rl.is_deleted = 0 AND rl.is_used = 1"; if (DbConnection != null) { var rd = await DbConnection.QueryMultipleAsync(cmd, transaction : DbTransaction); rd.Read <RetailerLocation, Address, Contact, RetailerLocationViewModel>( (rlRs, aRs, cRs) => { if (result == null) { result = CommonHelper.Mapper <RetailerLocation, RetailerLocationViewModel>(rlRs); } if (result.Address == null) { result.Address = aRs; } if (result.Contact == null) { result.Contact = cRs; } return(result); } ); return(result); } else { using (var conn = DALHelper.GetConnection()) { var rd = await conn.QueryMultipleAsync(cmd); rd.Read <RetailerLocation, Address, Contact, RetailerLocationViewModel>( (rlRs, aRs, cRs) => { if (result == null) { result = CommonHelper.Mapper <RetailerLocation, RetailerLocationViewModel>(rlRs); } if (result.Address == null) { result.Address = aRs; } if (result.Contact == null) { result.Contact = cRs; } return(result); } ); return(result); } } }
public AddLocationCommand(RetailerLocationViewModel location) { Location = location; }
public UpdateLocationCommand(RetailerLocationViewModel location) { Location = location; }